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 turnRight(){
- turnLeft();
- turnLeft();
- turnLeft();
- }
doesnt work
ReplyDelete