SHARE
TWEET

CodeHS | 2.13.4 - Random Hurdles

470m May 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function start() {
  2.     //This makes Karel move to all the hurdles
  3.     for (var i = 0; i < 13; i++) {
  4.         if (frontIsBlocked()) {
  5.             jumpHurdle();
  6.         } else {
  7.             move();
  8.         }
  9.     }
  10. }
  11.  
  12. function jumpHurdle() {
  13.     //This makes Karel jump over the hurdles
  14.     turnLeft();
  15.     move();
  16.     turnRight();
  17.     move();
  18.     turnRight();
  19.     move();
  20.     turnLeft();
  21. }
RAW Paste Data
Top