Bill the robot exists in two dimensional space. His world is bounded on the west and south by two walls that extend infinitely to the north and east respectively. These walls prevent Bill from falling over the edge of his world. Crisscrossing Bill's world are horizontal streets (running east-west) and vertical avenues (running north-south) at regular one block intervals. A (street) corner is located at the intersection of a street and an avenue. Bill can be positioned on any corner, facing one of the four directions - east, west, north or south. Each corner can be identified uniquely by its street and avenue numbers.
In addition to Bill, there are two types of objects in this world. The first type of object is a wall section. Wall sections exist in various lengths and are positioned sideways between adjacent street corners, effectively blocking Bill's path from one corner to the next. Bill must navigate around these wall sections. The second type of object is a beeper. These beepers are placed on street corners and they emit a soft beeping sound that can only be heard by Bill if he is situated on the same corner as the beeper. Some of Bill's tasks involve picking up, transporting and laying down these beepers.
Bill is a mobile robot. He can move forward in the direction he is facing, and he can turn in place. He has an internal compass that he can consult to determine the direction he is facing. Bill can see using his three TV cameras which point straight ahead, to his left, and to his right. These three cameras are focused to detect walls exactly one half of a block away from Bill. As stated earlier, Bill can hear beepers - only if he and the beeper are situated on the same street corner. Finally, Bill has a mechanical arm which he can use to pick up and lay down beepers. He carries these beepers in a soundproof bag. He can determine if there are any beepers in the bag by probing it with his arm.
Your task is to make Bill perform a variety of tasks. In order to do this you must supply him with a detailed set of instructions. Each instruction must be terminated with a semicolon. Bill is capable of receiving and memorizing these instructions - whch constitute a program. Bill cannot understand standard English. He has a very limited vocabulary and you must program him using a special programming language designed for programming robots. The following is the set of words that comprises Bill's vocabulary. Instructions for changing position, and handling beepers form Bill's basic or primitive command set.
move | This moves Bill forward one block in the direction he is facing. If there is a wall section obstructing his path, he will perform an error shutoff. |
turnleft | This will make Bill pivot 90o to the left. |
pickbeeper | This instructs Bill to pick up the beeper on the current street corner and put it in his beeper bag. If there is no beeper, Bill will perform an error shutoff. If there is more than one beeper, Bill will randomly pick up one. |
putbeeper | This instructs Bill to retrive a beeper from his beeper bag and put it on the current street corner. If there are no beepers in his bag, Bill will perform an error shutoff. |
IF <test> THEN <instruction> | This tells Bill that IF test is true THEN the instructions should be executed. |
IF <test> THEN <instruction> ELSE <instruction> | Same as above, additionally it provides Bill with an alternate set of instructions to be executed if the test is not true. Examples ... |
ITERATE <positive-number> TIMES <instruction> | This instructs Bill to repeat the instruction positive-number of times. Examples... |
WHILE <test> DO <instruction> | Instructs Bill to execute the instruction as long as the test is true. Examples... |
turnoff | This will switch Bill off. He will need to be restarted in order to perform another task. This should be the last instruction in a program. |