hts.StevenWood.com

Karel 2b

Home ] Up ] Karel 1 ] Karel 1b ] Karel 2 ] [ Karel 2b ] Karel 3 ] Karel 4 ] Karel 5 ] Karel 5b ] Karel 6 ] Karel 6b ] Graphics: Types some words ] Graphics: Spell your name ] Graphics: Fall scene ][ Last Page ]

Karel 2b: Inheritance

Complete the following in class or for homework.

1.

The ClarkKentRobot is a child of the ExperimentRobot. It likes to jump to the top of a tall building in a single bound. Write a program that will have a ClarkKentRobot robot jump straight up and then go over the CN Tower. On top of the tower there is a thing to pick up. The robot lands in the spot shown and put the thing down. Use the city file 'Toronto.txt' to create the city. (Save the Toronto.txt file in the same directory as this question.)

There are TWO ways (one "cheap" and one "elegant") to get the robot to pick up the coin and not the flashing light.

Elegant way: Examine the Robot documentation. Find out how Robots can pick up a specific type of Thing by looking at IPredicate:

 

Cheap: Edit the text file...

Do NOT hand in your work unless other instructions were given.


Initial Position

Final Position
 
Home ] Up ] Karel 1 ] Karel 1b ] Karel 2 ] [ Karel 2b ] Karel 3 ] Karel 4 ] Karel 5 ] Karel 5b ] Karel 6 ] Karel 6b ] Graphics: Types some words ] Graphics: Spell your name ] Graphics: Fall scene ][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+