public void move() { int newRow = nextRow(row, direction); int newColumn = nextColumn(column, direction); if (maze.isValid(newRow, newColumn)) { maze.updateRobot(row, column, -1); row = newRow; column = newColumn; maze.updateRobot(row, column, +1); visited.add(getPosition()); if (debug) { maze.print(); } } }
public Robot(Maze aMaze, int startingRow, int startingColumn) { maze = aMaze; row = startingRow; column = startingColumn; visited = new ArrayList<String>(); visited.add(getPosition()); maze.updateRobot(startingRow, startingColumn, 1); }