Karel Level 1
Level 1
Start
Help Karel the robot clean up her world!
Commands
Tell your robot how to complete this level by writing commands. Commands go in the Robot
tab inside the commands
method
void commands() {
// put your robot instructions here!!!
}
Here's a list of the commands you can use.
- move()
- Move the robot forward one square in her current direction.
- A wall must not be directly in front of the robot when moving.
- turnLeft()
- Turn the robot left 90 degrees.
- pickBeeper()
- Tell the robot to pick up a beeper from the world.
- A beeper must exist at the robot's current position.
- putBeeper()
- Tell the robot to put down a beeper at her current position.
- The robot must have beepers in her beeper bag.
- turnOff()
- Stop running commands and print the results.
Speed
You may want to speed up the world to see if later parts of your solution work correctly. You can make your robot move faster by opening the Level_1
tab and changing line 8
:
world.setDelay(400);
The number in between the parentheses is the time in milliseconds to wait before moving on to the next command. Lower numbers mean faster robots.
Goal
This is what it should look like when you have successfully completed the level.
Results
When you turnOff
your robot, it will print information to the console. Compare yours to a typical solution below. If you used a lot more moves or turns, re-think the problem and try to create a more efficient solution.
Moves | 67 |
Turns | 28 |
Puts | 4 |
Picks | 4 |