Posts

1.9.5: Marathon Karel, 1.9.6: Take 'em All, 1.9.7: Dizzy Karel, 1.9.8: For Loop Square, 1.9.9: Lots of Hurdles

Code for these lessons: 1.9.5: Marathon Karel public void run(){      for(int i = 0; i < 26; i++){           move();      } } 1.9.6: Take 'em All public void run(){        move();      for(int i = 0; i < 100; i++){           takeBall();      }      move(); } 1.9.7: Dizzy Karel public void run(){         for(int i = 0; i < 32; i++){           turnLeft();      } } 1.9.8: For Loop Square public void run(){         for(int i = 0; i < 4; i++){           putBall();           move();           turnLeft();      } } 1.9.9: Lots of Hurdles public void run(){      for(int i = 0; i < 5; i++){           move();           move();           turnLeft();           move();           turnRight();           move();           turnRight();           move();           turnLeft();      } }

1.5.4: Pancakes, 1.5.5: Mario Karel

Code for these lessons: 1.5.4: Pancakes public void run(){      move();      putBall();      putBall();      putBall();      move();      move();      putBall();      putBall();      putBall();      move();      move();      putBall();      putBall();      putBall();      move(); } 1.5.5: Mario Karel public void run(){      move();      jumpUp();      move();      move();      jumpDown();      move();      move();      jumpUp();      move();      move();      jumpDown(); } private void jumpUp(){      turnLeft();      for(int i = 0; i < 4; i++){           move();           if(ballsPresent()){                takeBall();                takeBall();           }      }      turnRight(); } private void jumpDown(){      turnRight();      for(int i = 0; i < 4; i++){           move();           if(ballsPresent()){                takeBall();                takeBall();           }      }      turnLeft(); } private void turnRigh

1.4.4: Slide Karel, 1.4.5: Fireman Karel

Code for these lessons: 1.4.4: Slide Karel public void run(){ putBall(); move(); turnRight(); move(); putBall(); move(); turnLeft(); move(); putBall(); } private void turnRight(){      turnLeft();      turnLeft();      turnLeft(); } 1.4.5: Fireman Karel public void run(){      turnRight();      move();      move();      move();      turnLeft(); } private void turnRight(){      turnLeft();      turnLeft();      turnLeft(); }

1.3.4: Tower Karel, 1.3.5: Gold Medal Karel, 1.3.6: Maze Karel

Code for these lessons: 1.3.4: Tower Karel move(); turnLeft(); putBall(); move(); putBall(); move(); putBall(); move(); turnLeft(); turnLeft(); turnLeft(); 1.3.5: Gold Medal Karel move(); putBall(); move(); putBall(); move(); putBall(); turnLeft(); move(); turnLeft(); move(); putBall(); turnLeft(); turnLeft(); turnLeft(); move(); turnLeft(); turnLeft(); turnLeft(); 1.3.6: Maze Karel while(frontIsClear()){      move();      if(frontIsBlocked()){           turnLeft();      } } turnLeft(); turnLeft(); while(frontIsClear()){      move();      if(frontIsBlocked()){           turnLeft();           turnLeft();           turnLeft();      }      if(frontIsBlocked()){           turnLeft();      }      while(frontIsClear()){           move();           if(frontIsBlocked()){                turnLeft();                turnLeft();                turnLeft();           }           if(frontIsBlocked()){                turnLeft();    

1.2.4: Make A Tower

code for this lesson: move();   turnLeft(); putBall(); move(); putBall(); move(); putBall(); move(); turnLeft(); turnLeft(); turnLeft();

CodeHS

    I'm in AP Computer Science A this year, and our teacher has us doing this thing called CodeHS, which is essentially a platform for learning code.  I am going to be posting my (correct) answers for all of my class curriculum on CodeHS to this blog, since I can't find any of the solutions to the lessons online.