- AntWalk Write a program to simulate the random movement of an ant walking on a
coordinate grid with dimensions 9x9. Position the ant in cell (4,4) to begin. Then allow the ant to
move randomly up, down, left or right. The ant stops when it falls off of the grid (goes to 0 or 10
in either direction). In the example below, the ant falls off the grid to the South, noted by the X.
As the ant is moving, you need to keep track of the following information:
The number of moves before falling off
The number of times the ant visited each cell (displayed in the matrix)
Which direction the ant fell off the grid (North, South, East or West)
Note: You must update and redisplay the matrix after each movement
Here is my code, for some reason its not displaying the proper direction the ant fell..
https://pastebin.com/1z69JgbQ
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.