3.7 - The Wandering Ant on a Square Grid
12. Random Walk in 2-Dimensions
9. The Deer Program and Population Dynamics
Suppose that the ant is not forced to step just along a line, but can move in four mutually perpendicular directions when walking away from the lamp post. This type of movement is called a 2-dimensional random walk.
For example, an ant is standing in the center of a 11 by 11 grid, as shown in Figure . Each grid square is the size of one step. The ant can move one step at a time in one of four directions: north, south, east, or west. The ant cannot move diagonally or take more than one step at a time. If the ant walks off the edge of the grid, it cannot return.