/* * PreCondition:none * PostCondition: checks if coordinates of robot are the same and then move robot to next grid if there isn't wall else previous grid */ private void Check() //Checks if the robot hits a wall and then dives into next grid { if (robotObj.getColumn() == cCoord && robotObj.getRow() == rCoord && subObj.getDepth() < numberofGrids) { robotObj.setGrid(subObj.dive(robotObj.getRow(), robotObj.getColumn())); } if (robotObj.getColumn() == cCoord && robotObj.getRow() == rCoord && subObj.getDepth() >= numberofGrids) { robotObj.setGrid(subObj.climb(robotObj.getRow(), robotObj.getColumn())); } rCoord = robotObj.getRow(); cCoord = robotObj.getColumn(); }