Assignment 1 - Hurdle Racing
Hurdle Race
Karel is running a hurdle race. The hurdles are two blocks high and spaced out in regular intervals. There are 6 hurdles altogether, and Karel is supposed to stop after the last hurdle, facing east.
St.¦ 3¦ . . . . . . . . . . . . . ¦ 2¦ . . ¦ . . ¦ . . ¦ . . ¦ . . ¦ . . ¦ . ¦ ¦ ¦ ¦ ¦ ¦ ¦ 1¦ > . ¦ . . ¦ . . ¦ . . ¦ . . ¦ . . ¦ . +-------------------------------------------------- 1 2 3 4 5 6 7 8 9 10 11 12 13 Ave.
Your assignment should include Karel's program as well as Karel's word file.
Karel is running another hurdle race. There are 5 hurldes anywhere with the first 10 blocks. Hurdles have height 2 and are spaced at irregular intervals. There is always a gap of at least one street between hurdles.
St.¦ 3¦ . . . . . . . . . . ¦ 2¦ . ¦ ¦ . . ¦ . . . ¦ . . ¦ . ¦ ¦ ¦ ¦ ¦ ¦ 1¦ > ¦ . ¦ . . ¦ . . . ¦ . . ¦ . +--------------------------------------- 1 2 3 4 5 6 7 8 9 10 Ave.
Karel is to run his final hurdle race. This time the hurdles can be any height and any width. They are irregularly spaced, with a gap of at least one street between. The end of the course is marked by a single beeper. Karel is supposed to run the track, pick up the finishing beeper, and turnoff.
St.¦ 6¦ . . . . . . . . . . . . . . . ¦ +---+ 5¦ . . . . . . . . . . . ¦ . ¦ . . . ¦ +-----------+ ¦ ¦ 4¦ . . . . ¦ . . . ¦ . . . . ¦ . ¦ . . . ¦ ¦ ¦ ¦ ¦ 3¦ . . . . ¦ . . . ¦ . . . . ¦ . ¦ . . . ¦ +-------+ ¦ ¦ ¦ ¦ 2¦ . ¦ . . ¦ . ¦ . . . ¦ . . . . ¦ . ¦ . . . ¦ ¦ ¦ ¦ ¦ +---+ ¦ ¦ 1¦ > ¦ . . ¦ . ¦ . . . ¦ . . ¦ . ¦ . ¦ . ¦ . . o +---------------------------------------------------------- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Ave.
The three programs should be named hurdle1.krl, hurdle2.krl, hurdle3.krl. The world file for the first task should be named hurdle1.wol. I will use my own world files for the other two problems.When you have succesfully solved each task, please send me the three programs and the one world as an attachment to a mail message. Please attach all four files to that one message. Make sure you pick the correct files to attach.