Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. function start() {
  2. //It's way too complicated to explain now...
  3. cleanRowA();
  4. }
  5.  
  6.  
  7. function checkBall(){
  8. if(ballsPresent()){
  9. takeBall();
  10. }
  11. }
  12.  
  13. function cleanRowA(){
  14. while(frontIsClear()){
  15. checkBall();
  16. move();
  17. }
  18. checkCorner();
  19. }
  20.  
  21. function cleanRowB(){
  22. while(frontIsClear()){
  23. checkBall();
  24. move();
  25. }
  26. checkCorner2();
  27. }
  28.  
  29. function checkCorner(){
  30. turnLeft();
  31. if(frontIsClear()){
  32. checkBall();
  33. move();
  34. checkBall();
  35. turnLeft();
  36. cleanRowB();
  37. }
  38. checkBall();
  39. }
  40.  
  41. function checkCorner2(){
  42. turnRight();
  43. if(frontIsClear()){
  44. checkBall();
  45. move();
  46. checkBall();
  47. turnRight();
  48. cleanRowA();
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement