CSE 111, Fall 00, HW #4EC

CSE 111, Fall 2000

#### HW #4EC: KAREL THE ROBOT GETS DIZZY

Last Update: 2 October 2000 Note: material is highlighted.

Suppose that Karel's initial situation is that he could be located anywhere on the grid, that he might (or might not) have some beepers in his bag, and that there are no walls.

Use top-down design and stepwise refinement to write a complete Karel program that has Karel empty his beeper bag on the corner that he is standing at, get dizzy (where getting dizzy consists of Karel turning right 100 times), and then go home (where home = the origin). It does not matter what direction Karel is facing when he gets home (he's too dizzy to care).

#### Suggestion:

To test your program, only have Karel turn right 10 times, not 100. But your final program should have him turn right 100 times.

THIS IS AN EXTRA-CREDIT ASSIGNMENT: IT IS OPTIONAL, BUT, IF YOU DO IT, THEN THE GRADE YOU GET ON IT CAN REPLACE A LOW H.W. GRADE DUE: AT THE START OF LECTURE: FRI., OCT. 6