hts.StevenWood.com

[ Last Page ]

Robot Review Questions

1. A robot is completely enclosed in a room that has, litter strewn all over the floor. Create a new class of robot that can pick up the litter. The size of the room is unknown and the amount of litter on each intersection is also unknown. The robot starts in the north-west corner facing east and should return there when its task is complete.

Don't forget to use helper methods.

2. Write a new Robot class, Houdini, that includes a method named escapeRoom. It will cause the robot to search for an exit to the room - a break in the wall. Such an exit always exists and is never in a corner.

3. Create the class diagram for the project Karel 4
4. Create the class diagram for the project Karel 7
5.  Create a class of robot called SpinFirstBot that, before it turns left, spins 360 degrees to the right and, before it turns right, spins 360 degrees to the left.

Test your robot with this city file Victoria.txt.

6. Create a class of robot called MaxLoadBot that can only hold 10 things in its backpack. Before it picks up any Things it checks to see how many things are already in its backpack. If it has less than 10 Things it will pick up the Thing, if there are 10 Things in the backpack already, it will leave the Thing.

Test your robot with this city file Oz.txt. Turn on the city feature that displays how many items are on each corner.

 

 
[Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+