SHARE
TWEET

CodeHS | 2.16.2 - Racing Karel

470m May 19th, 2017 (edited) 180 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* This program will have Karel run around the racetrack
  2.  * 8 times. */
  3. function start() {
  4.     putBall8();
  5.     while(frontIsClear()){
  6.         move();
  7.     }
  8.     putBall8();
  9.     turnLeft();
  10.     while(frontIsClear()){
  11.         move();
  12.     }
  13.     putBall8();
  14.     turnLeft();
  15.     while(frontIsClear()){
  16.         move();
  17.     }
  18.     putBall8();
  19.     turnLeft();
  20.     while(frontIsClear()){
  21.         move();
  22.     }
  23.     turnLeft();
  24. }
  25. function putBall8() {
  26.     for(var i = 0; i < 8; i++){
  27.         putBall();
  28.     }
  29. }
  30. function takeBall8() {
  31.     move();
  32. }
RAW Paste Data
Top