Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function start() {
- if (facingEast()){
- makeRightSquare();
- }
- if (facingNorth()){
- makeLeftSquare();
- }
- }
- function makeRightSquare(){
- if (noBallsPresent()){
- putBall();
- }
- move();
- turnLeft();
- if (noBallsPresent()){
- putBall();
- }
- move();
- if (noBallsPresent()){
- putBall();
- }
- turnLeft();
- if (noBallsPresent()){
- putBall();
- }
- move();
- if (noBallsPresent()){
- putBall();
- }
- turnLeft();
- move();
- turnLeft();
- if (noBallsPresent()){
- putBall();
- }
- }
- function makeLeftSquare(){
- if (noBallsPresent()){
- putBall();
- move();
- turnRight();
- putBall();
- move();
- putBall();
- turnRight();
- move();
- putBall();
- turnRight();
- move();
- turnRight();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement