Guest User

Untitled

a guest
Jan 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. public boolean move(Maze rigting, int pos)
  2. {
  3. if (rigting.goal == true)
  4. {
  5. return true;
  6. }
  7. if (rigting.wallR != true)
  8. {
  9. pos += 1;
  10. move(rigting.right, pos); //moves right
  11.  
  12. showLabel(pos);
  13. return true;
  14. }
  15. if(rigting.wallD != true) //checks if there is a wall below
  16. {
  17. pos += 10;
  18. move(rigting.down, pos); //moves down
  19.  
  20. showLabel(pos);
  21. return true;
  22. }
  23. if(rigting.wallL != true) //checks if there is a wall on the left
  24. {
  25. pos -= 1;
  26. move(rigting.left, pos); //moves left
  27.  
  28. showLabel(pos);
  29. return true;
  30. }
  31. if(rigting.wallU != true) //checks if there is a wall above
  32. {
  33. pos -= 10;
  34. move(rigting.up, pos); //moves up
  35.  
  36. showLabel(pos);
  37. return true;
  38. }
  39.  
  40. return false;
  41. }
  42.  
  43. public boolean move(Maze rigting, int pos)
  44.  
  45. {
  46. if (rigting.goal == true)
  47. {
  48. return true;
  49. }
  50.  
  51. if (rigting.wallR != true)
  52. {
  53. pos += 1;
  54. showLabel(pos);
  55. return move(rigting.right, pos); //moves right
  56. }
  57.  
  58. if(rigting.wallD != true) //checks if there is a wall below
  59. {
  60. pos += 10;
  61. showLabel(pos);
  62. return move(rigting.down, pos); //moves down
  63. }
  64. if(rigting.wallL != true) //checks if there is a wall on the left
  65. {
  66. pos -= 1;
  67. showLabel(pos);
  68. return move(rigting.left, pos); //moves left
  69. }
  70.  
  71. if(rigting.wallU != true) //checks if there is a wall above
  72. {
  73. pos -= 10;
  74. showLabel(pos);
  75. return move(rigting.up, pos); //moves up
  76. }
  77.  
  78. return false;
  79. }
Add Comment
Please, Sign In to add comment