finished simplifying the code - milestone 2 done

something i figured out is write to code so it works first then simplify it
This commit is contained in:
tsmith37
2025-09-25 17:15:23 -04:00
parent cbf426722a
commit e4e9bf01a8
3 changed files with 39 additions and 137 deletions

View File

@@ -1,5 +1,6 @@
from turtle import *
def board(side_length):
"Out line of the board"
sides = [side_length, side_length, side_length, side_length]
@@ -7,28 +8,12 @@ def board(side_length):
pensize(4)
forward(sides)
right(90)
def square(size):
"Draws a square of side length `size`"
for side in range(4):
forward(size)
right(90)
def black_tile(size):
def blue_coin(size):
begin_fill()
fillcolor('black')
square(size)
fillcolor('blue')
circle(size)
end_fill()
input()
def white_tile(size):
begin_fill()
fillcolor('white')
square(size)
end_fill()
def red_coin(size):
begin_fill()
@@ -37,25 +22,11 @@ def red_coin(size):
end_fill()
def blue_coin(size):
begin_fill()
fillcolor('blue')
circle(size)
end_fill()
def black_row(size):
def black_tile(size):
"black tile first"
repeat = [1, 2, 3, 4]
for repeat in repeat:
forward(size)
right(90)
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
pendown()
input()