Two-dimensional array (N X M) must be utilized to represent number of times the bug reached each tile on floor. All cells of this array must be initialized to zero. Position of bug on floor is represented by coordinates (i-bug, j-bug). Eight possible moves bug can make at each time interval are represented by tiles located at [i-bug + i-move(k), j-bug + j-move(k)] where 1