~cs111/DataFiles/data_file_for_hwk_7_1
~cs111/DataFiles/data_file_for_hwk_7_1
We want you to use the list of commands given on page 251, except that we want you to cancel the 5th command:
5,10 Move forward 10 spaces (or a number other than 10)
and add the following new commands:
10 Move
forward by 0 space
11 Move
forward by 1 space
12 Move
forward by 2 spaces
13 Move
forward by 3 spaces
etc.
As an example, if you start at position 0,0 and you receive the command "2", you should put the "pen down" but leave no mark in position 0,0. If you next receive the command "12", you should move from position 0,0 to position 0,2 and, because the pen is down, you should leave a mark in positions 0,0 and 0,1 but not in position 0,2.
Take into account the possibility of a command that moves the turtle outside the board (an error message should be issued and the session terminated). Turn in your program just after testing it on the data file:
~cs111/DataFiles/data_file_for_hwk_7_2
You can run the (compiled) program "exercise_6.23_page_251.out" in directory ~cs111/DataFiles to see an output sample.
Assaf Kfoury Created: 98.03.27
Modified: 98.04.04