Files
project_drawing/drawing.py
tsmith37 2b48b85065 Finished making the board now starting on the checker pieces
something im wondering about is how can I shorten my code
2025-09-24 23:52:16 -04:00

186 lines
2.7 KiB
Python

# drawing.py
# ----------
# By ____(you)___________
#
# (Briefly describe what this program does.)
from turtle import *
def board(side_length):
"Out line of the board"
sides = [side_length, side_length, side_length, side_length]
for sides in sides:
pensize(4)
forward(sides)
right(90)
def blue_coin(size):
begin_fill()
fillcolor('blue')
circle(size)
end_fill()
penup()
goto(-300, 200)
pendown()
board(400)
"first row"
def black_row(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()
right(90)
forward(50)
right(90)
forward(400)
left(180)
forward(50)
"second row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
right(90)
forward(50)
right(90)
forward(50)
pendown()
forward(400)
left(180)
"third row - black tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
pendown()
right(90)
forward(50)
right(90)
forward(400)
left(180)
forward(50)
"fourth row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
right(90)
forward(50)
right(90)
forward(50)
pendown()
forward(400)
left(180)
"five row - black tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
pendown()
right(90)
forward(50)
right(90)
forward(400)
left(180)
forward(50)
"six row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
right(90)
forward(50)
right(90)
forward(50)
pendown()
forward(400)
left(180)
"seven row - black tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
pendown()
right(90)
forward(50)
right(90)
forward(400)
left(180)
forward(50)
"eight row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_row(size)
end_fill()
penup()
forward(size * 2)
right(90)
forward(50)
right(90)
forward(50)
pendown()
forward(400)
left(180)
forward(75)
blue_coin(25)
input()