[VISIBLE ONLY LOCALLY] Optionally view what the website will look like at another time (in PDT):
Credit: Lisa Yan
Karel has been hired to build the arches done to the Stanford Main Quad in the 1989 Loma Prieta earthquake. Or use your imagination! Karel has been hired to build the columns of the Charles Bridge, or the columns in the Temple of Artemis in Efes. In particular, there are a set of arches where the stones (represented by beepers, of course) are missing as below:
When Karel is done, the missing columns should be replaced by beepers, so the final picture would look like this:
Karel may count on the following facts about the world, listed below:
This problem is a great opportunity to practice decomposition. For example, it would make sense to have a
One thing that computers are really good at is repeating commands.
In general, if you know before hand that there is a block of code you would like to repeat many times you can use a "for" loop, which looks like this:
for i in range(n): ... your code ...
n, you should write the number of times you want your code to be repeated.
For example if you want to move forward ten times, instead of writing the move(); command ten times you could write:
for i in range(10): move()
See the Place 100 Beepers program for another example.
Your program will be much easier to write and easier to read, if you use
for loops. There are multiple opportunities to use them in this problem!