else // Facing West turnRight(); move(); turnRight();
Karel starts at (1, 1) facing East. You need to fill the world with beepers in a checkerboard pattern. The catch? Your code must work for a 1x1 world, an 8x8 world, and even a 5x2 world. 645 checkerboard karel answer verified
public void run() fillRow(); while (leftIsClear()) moveToNextRow(); fillRow(); if (rightIsClear()) moveToNextRow(); fillRow(); else // Facing West turnRight(); move(); turnRight(); Karel
This is where most students get stuck. When Karel reaches the end of a row, he needs to move up to the next row and face the opposite direction. Your code must work for a 1x1 world,
By moving twice inside the makeRow function, you automatically handle the "every other" logic without needing a complex "beeper-at-last-spot" variable. Common Pitfalls to Avoid
Karel needs to move up to the next street and face the right direction.