Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean move(Maze rigting, int pos)
- {
- if (rigting.goal == true)
- {
- return true;
- }
- if (rigting.wallR != true)
- {
- pos += 1;
- move(rigting.right, pos); //moves right
- showLabel(pos);
- return true;
- }
- if(rigting.wallD != true) //checks if there is a wall below
- {
- pos += 10;
- move(rigting.down, pos); //moves down
- showLabel(pos);
- return true;
- }
- if(rigting.wallL != true) //checks if there is a wall on the left
- {
- pos -= 1;
- move(rigting.left, pos); //moves left
- showLabel(pos);
- return true;
- }
- if(rigting.wallU != true) //checks if there is a wall above
- {
- pos -= 10;
- move(rigting.up, pos); //moves up
- showLabel(pos);
- return true;
- }
- return false;
- }
- public boolean move(Maze rigting, int pos)
- {
- if (rigting.goal == true)
- {
- return true;
- }
- if (rigting.wallR != true)
- {
- pos += 1;
- showLabel(pos);
- return move(rigting.right, pos); //moves right
- }
- if(rigting.wallD != true) //checks if there is a wall below
- {
- pos += 10;
- showLabel(pos);
- return move(rigting.down, pos); //moves down
- }
- if(rigting.wallL != true) //checks if there is a wall on the left
- {
- pos -= 1;
- showLabel(pos);
- return move(rigting.left, pos); //moves left
- }
- if(rigting.wallU != true) //checks if there is a wall above
- {
- pos -= 10;
- showLabel(pos);
- return move(rigting.up, pos); //moves up
- }
- return false;
- }
Add Comment
Please, Sign In to add comment