How about a loop? You can compute your start/end coordinates and pass them as arguments to your drawing functions inside a loop. A loop would go over as many elements as you need.
–
milancurcicNov 28 '11 at 22:11

ask yourself, what does this draw? how is it different from what I expected?
–
KevinDTimmNov 28 '11 at 22:11

2 Answers
2

In this kind of problems, you should ask yourself what is the "atomic" operation that - repeated over and over - will generate your complete solution. You already found your basic "atom": drawing a side of a square:

t.forward(60)

Now, what is the next level of "atomicity"? Well, repeating four times a side, you can get a square (as you correctly found out yourself)

for a in range(4):
t.forward(60)
t.left(90)

Now along the same lines, you might come to the conclusion that if you repeat 8 times the above, you get a line, and if you repeat 8 times a line you'll get a complete check board. It should be something like:

for col in range(8):
for row in range(8):
# draw a square here

Now, you already wrote yourself the function to draw a square, the only problem is that you would need to draw each of them at different locations. The key point you have to focus here is: can you think of a method to calculate this location starting from the values of col and row?

If you get stuck, I posted a sample implementation here, I'm confident you won't need to check that out, but if you do, here's the extra assignment: instead of using that code as-is, turn the inner circle in a call to a separate function draw_square(row, col).

EDIT: For extra points and pride, once completed the exercise, observe how most lines in the check board are redrawn over and over. With very little effort you can double the efficiency of your program. Can you think how?

Consider adding arguments to start_point instead of creating new versions of
the function. For instance:

def start_point(x,y):
t.penup()
t.setpos(x,y)
t.pendown()

With this, you can eliminate start_pos1() and you are reusing code, which is good.

Along these lines, consider adding some flexibility to your other functions as well. For instance, why not have draw_turtlerow take a number that tells it how many squares to draw in the row? Then you could make another method that takes the number of rows you want - this function would then call draw_turtlerow and start_pos several times to draw the entire grid.

I'm not sure this is the right direction for you assignment, but I hope it points you in the right direction.