setu

Check Board Pattern

Sep 7th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Welcome to the Stanford Karel IDE.
  3.  * This is a free space for you to
  4.  * write any Karel program you want.
  5.  * Address: http://stanford.edu/~cpiech/karel/ide.html
  6.  **/
  7. function main(){
  8.    //your code here
  9.    checkBoardPattern();
  10.    checkBoardPattern();
  11.    putBeeper();
  12.    turningLeft();
  13.    checkBoardPatternForEven();
  14.    checkBoardPatternForEven();
  15.    turningRight();
  16.    checkBoardPattern();
  17.    checkBoardPattern();
  18.    putBeeper();
  19.    turningLeft();
  20.    checkBoardPatternForEven();
  21.    checkBoardPatternForEven();
  22.    turningRight();
  23.    checkBoardPattern();
  24.    checkBoardPattern();
  25.    putBeeper();
  26. }
  27. function checkBoardPattern() {
  28.    putBeeper();
  29.    move();
  30.    move();
  31. }
  32. function checkBoardPatternForEven() {
  33.    move();
  34.    putBeeper();
  35.    move();
  36. }
  37. function turningLeft() {
  38.    turnLeft();
  39.    move();
  40.    turnLeft();
  41. }
  42. function turningRight() {
  43.    turnRight();
  44.    move();
  45.    turnRight();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment