title: Java Antwalk - 2D Arrays
body: <p>There is a 2D array with dimensions 9x9. The ant starts in cell (5,5) , or the center. It moves randomly north, south, east, or west. The ant stops walking when it falls off the grid. The space where it falls is marked by an X. In the matrix, it should display the amount of times the ant visited each cell and the number of moves the ant took to fall off. </p>
  
  <p>I'm not sure where to start or how to go about it. Like how to make the north, south, west, east methods.</p>
  
  <p>Here's what I have so far. </p>
  
  <pre><code>public static void main(String [] args)
  {
      int [][] grid = new int[9][9];
  
      for (int r = 0; r&lt; grid.length; r++)
      {
          for (int c = 0 ; c&lt;grid[0].length; c++)
          {
              grid[r][c] = 0;
          }
      }
  
      boolean test = true;
      while(test)
      {
          int random =  (int)Math.random()*4+1;
          if (random == 1)
          {
  
          }
          else if (random == 2)
          {
  
          }
          else if (random == 3)
          {
  
          }
          else if (random == 4)
          {
  
          }
      }
  }
  </code></pre>