Handouts: KarelReference
Worked Example: Place100
Day1: arches_karel.py

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:

• Karel starts at 1st Avenue and 1st Street, facing east.
• The columns are exactly four squares apart, on 1st, 5th, 9th and 13th Avenue.
• Karel can assume that columns are always five units high.

This problem is a great opportunity to practice decomposition. For example, it would make sense to have a build_column function.

## For loops

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):



Instead of 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!