Hint 1
Check neighbours in current position using:
int[] neighbours = robot.checkNeighbours(robot.current_x, robot.current_y);
This will return and array called neighbours with 4 elements, neighbours[?, ?, ?, ?].
- neighbours[0] will store a 0, 1, 2 or 3 depending on the cell to the North
- neighbours[1] will store a 0, 1, 2 or 3 depending on the cell to the South
- neighbours[2] will store a 0, 1, 2 or 3 depending on the cell to the East
- neighbours[3] will store a 0, 1, 2 or 3 depending on the cell to the West
The 0, 1, 2, or 3 stored in the array represent the following:
- 0 - Unoccupied
- 1 - Occupied
- 2 - Starting cell
- 3 - Goal