/**
* Demonstrate 2-D Arrays 
* using an array of robots
*
* @author (Michael Branicky), 10/05/06, 10/02/07
*/
public class Robots {
  public static void main(String args[]) {
    final int M=10, N=50; // constant ints for array sizes

    int row, col;
    int botrow = -1, botcol = -1;

    // declare and create robot array
    int robot [][] = new int [M][N];

    // initialize it
    for (row=0; row<M; row++) {
      for (col=0; col<N; col++) {
        robot[row][col] = 5;
      }
    }

    // randomly assign the robot's location
    robot[(int) (Math.random()*M)][(int) (Math.random()*N)]=6;

    // display the matrix and find the robot
    for (row=0; row<M; row++) {
      for (col=0; col<N; col++) {
        System.out.print(robot[row][col]);
        if(robot[row][col]==6) {
          botrow = row;
          botcol = col;
        }
      }
      System.out.println();
    }
    System.out.println("\nHe's at location ("+botrow+", "+botcol+") !\n");
  }
}
