Tuesday 15 June 2010

python turtle checkerboard each line starts 30 pixels to the right -


I am trying to create a checkboard I have this code that works to make a checker board, it Rows do not match, how do I get to start each row from the beginning, for example, go back to the previous 150. I have tried 1 row, backward 150 and then second bench 120

  import turtle turtle (0) def go_to_start (): turtle.pu () Turtle behind (150) Turtle Bowl (90) for turtle. Next (250) Turtle Wright (90) Turtle DD (DIF): (T): Turtle.bg_fill () Range (4): For turtles, for the turtle ('black'). (30) Turtle Wright (90) Turtle. And_Fill () Turtle (.) For turtles. (60) Turtle DD () DEF First_O (): Turtle Previous (180) Turtle Wright (90) Turtle Forvor (30) Turtle Wright (270) Turtle PD () def seconds_O (): Turtles. () Behind the turtles (150) Turtle Wright (90) Turtles. (5): For range (5): Color () second_row () first_row ()  
(270) Turtle.PD (for go_to_start) P>

This is going back to the same distance to the second row of the table, this is not correct. You need to apply some arguments to return the correct amount for each line. As an example, you can change the first_row, second_o, and for loop with it:

  def reset (): turtles (.) () Turtle (300) Turtle . Wright (90) Turtle for J (30) in Turtle Range (5) Wright (270) Turtle Wright (270) Turtle.PD (): In Range (5): Color () # If the line is also, then proceed 30 J + 2 == 0: Forwarded for Turtles (30) # If the line is weird, Then go 30 and go back: Turtle. Backward (30) reset ()  

No comments:

Post a Comment