hts.StevenWood.com

Karel 15a

Home ] Up ] Karel 15 ] [ Karel 15a ] Karel 15b ] Karel 15c ] Karel 15d ] Boolean Logic ] CheckList ] Rubric ][ Last Page ]

Karel 15a

Complete the following in class or for homework. Do NOT hand in your work unless other instructions were given.

1. Karel is in a completely enclosed rectangular room that has, unfortunately, litter strewn all over it (see the sample room given below). Create a new class of robot that can pick up the litter. This robot is a child of Robot.

The room is always 4 intersections wide and 3 intersection high.

Karel always starts in the top-left corner and maybe facing any direction. You must turn and face east before you start cleaning up.

Karel should move back to its starting location when its task is complete.  It should then face north.

Examine the Robot  documentation to find out how to make the city display the number of things that are on each intersection.

You must make one new method that will pick up all of the items that are on the intersection. You can assume that there is no more than 4 pieces of litter on any intersection. As you move the robot in the city, use the new method on each intersection.

Create two different city files that contain:

  • the walls; and
  • a different number of pieces of litter and in different locations

so that you can test your robot.

 
2. Build another version of LitterBot that is called LitterBotSE and extends RobotSE.

Examine the Robot  documentation to find out easier ways of having this robot clear the room.

 
Home ] Up ] Karel 15 ] [ Karel 15a ] Karel 15b ] Karel 15c ] Karel 15d ] Boolean Logic ] CheckList ] Rubric ][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+