Question: The Fifth Task (10 marks) Improve upon the previous task by implementing wrapping: if the ant has reached the edge of the board and is
The Fifth Task (10 marks)
Improve upon the previous task by implementing wrapping: if the ant has reached the edge of the board and is about to step off, it should appear on the other side of the board. For example, if it is about to step of the bottom of the board, it should appear in the first row on the next step.
8.1 Input
The first line of input is an integer T , the number of steps to simulate. The next line consists of two integers r and c, separated by a single space. These are the number of rows and columns of the grid. Every cell is initially white. The next line consists of two integers m and n, separated by a single space, specifying the row and column location of the ant (recall that the ant starts facing north).
8.2 Output
Output the initial board representation, and then the board after every step taken. The represen- tations should be the same as they are in The First Task. Each board output should be separated by a single blank line.
Sample Input
2
5 5
2 4
Sample Output
00000
00000
00000
00000
00000
00000
00000
00001
00000
00000
00000
00000
10001
00000
00000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
