Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean checkBeeperStack(int x, int y, int numBeepers) {
- for(int i=0; i < y; ++i){
- moveRobotForwards();
- }
- turnRobotRight();
- for(int i=0; i < x; ++i){
- moveRobotForwards();
- }
- if (countBeeperStack() == numBeepers){
- return true;
- }
- moveRobotBack();
- return false;
- }
- void turnRobotRight(){
- turnRobotLeft();
- turnRobotLeft();
- turnRobotLeft();
- }
- int countBeeperStack(){
- int counter = 0;
- while(isItemOnGroundAtRobot()){
- pickUpItemWithRobot();
- ++ counter;
- }
- return counter;
- }
- void moveRobotBack(){
- turnRobotLeft();
- turnRobotLeft();
- while(isSpaceInFrontOfRobotClear()){
- moveRobotForwards();
- }
- turnRobotLeft();
- while(isSpaceInFrontOfRobotClear()){
- moveRobotForwards();
- }
- turnRobotLeft();
- turnRobotLeft();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement