Skip to main content Skip to navigation

Hint 2

The maze array holds the robots representation of the environment. After each move we can update the maze array.

//based on the current position
int x = robot.current_x;
int y = robot.current_y;

//update the cell to the North (y-1) in maze[][]
maze[x][y-1] = neighbours[0];

//update the cell to the South (y+1) in maze[][]
maze[x][y+1] = neighbours[1];

//update the cell to the East (x+1) in maze[][]
maze[x+1][y] = neighbours[2];

//update the cell to the West (x-1) in maze[][]
maze[x-1][y] = neighbours[3];