The assignment is to write down instructions for a robot to make a PB&J sandwich with the following starting information.
Contents of the Room: Cupboard (closed), Counter, Sink, Drawer (closed), and Refrigerator (closed)
Contents of Cupboard: Plate, Cup, Bowl
Contents of Counter: PB_Jar (closed)
Contents of Drawer: Knife, Spoon, Fork, Cheese_Grater, Carrot_Peeler
Contents of Refrigerator: Jelly_Jar (closed), Bread_Loaf_Bag (closed)
Contents of PB_Jar: Peanut_Butter
Contents of Jelly_Jar: Jelly
Contents Bread_Loaf_Bag: 10x Slice_of_Bread (note: only two are needed)
The instructions are: Note that all objects not marked “(closed)” are open, and may be used. Other objects can only be taken or removed from open objects. All objects except those used up in the creation of the sandwich must end up where they started, and closed if they started as closed. Exception: Contents of Cupboard and Drawer are placed in the Sink when used. The sandwich must end up on a Plate.
When an object contains another object, it is written like this: Room/Refrigerator/Jelly_Jar. This means the Jelly_Jar is inside the Refrigerator, inside the Room. ALL objects are written this way, and always start with “Room”, “Right” or “Left” (as you'll see below). In this context, “Room” is known as the “root object” and “Jelly_Jar” is the “top level object”.
Note also that objects can only be accessed if the object that contains them is open. For example, you can only access Jelly Jar if Refrigerator is open. Note also that root objects are always open, and cannot be closed.
Robbie has two hands, Right and Left, and each may hold one object, though that object may contain other objects. It can only interact with objects it is holding, except for the contents of the Room (Cupboard, Counter, Sink, Drawer, or Refrigerator). To OPEN or CLOSE any object, Robbie must use a hand that does NOT contain an object.
End goal:
Right (or Left)/Plate/Slice_of_Bread/Peanut_Butter…
All other objects closed/disposed of as described previously
And here are the available things that we can command robbie (the robot) to do:
OPEN (object) (hand)
This opens the object specified using the hand specified, which must be empty.
Ex: “OPEN Room/Refrigerator Right”
CLOSE (object) (hand)
TAKE (object1) (object2) (hand)
Transfers object1 from object2 into the specified hand. Note: object2 must be open. Note also: anything object1 contains transfers also. So if you TAKE Jelly_Jar Refrigerator Right, there should now be an existing object called Right/Jelly_Jar/Jelly
PUT (hand/object1) (object2)
Transfers the contents of the specified hand into the specified object. Note that object1 must begin with have a hand (Right or Left) as its root.
Ex: PUT Right/Knife Room/Refrigerator (don't ask)
TRANSFER (hand)
This transfers the top level object from the specified hand to become the top level object in the other hand. Note that a free hand is NOT required, but every object in both hands must be open.
Ex: Given Left/Plate and Right/Slice_of_Bread, if you TRANSFER Right, you end up with Left/Plate/Slice_of_Bread and Right. Similarly, if you TRANSFER Right/PB_Jar/PB Left/Knife you will end up with Left/Knife/PB and Right/PB_Jar.
I know its long, but any help is appreciated, thanks!
Java comp. sci assignment help!
Started by Baumerr, Jul 23 2010 09:13 AM
1 reply to this topic


Sign In
Create Account

Back to top









