If Karel starts in the world
it should end with Karel standing on a beeper in the following position:
Note that the final configuration of the world should have only a single beeper at the midpoint of 1st Street. Along the way, Karel is allowed to place additional beepers wherever it wants to, but must pick them all up again before it finishes.
In solving this problem, you may count on the following facts about the world:
o Karel starts at 1st Avenue and 1st Street, facing east, with an infinite number of beepers
in its bag.
o The initial state of the world includes no interior walls or beepers.
o The world need not be square, but you may assume that it is at least as tall as it is wide.
o Your program, moreover, can assume the following simplifications:
o If the width of the world is odd, Karel must put the beeper in the center square. If the
width is even, Karel may drop the beeper on either of the two center squares.
o It does not matter which direction Karel is facing at the end of the run.
There are many different algorithms you can use to solve this problem. The interesting part of this particular problem is to come up with a strategy that works.
No comments:
Post a Comment