reduced code repetition

I am not wondering how i will make the piece move
This commit is contained in:
tsmith37
2025-09-26 14:20:43 -04:00
parent e4e9bf01a8
commit 7ba89f2965
2 changed files with 49 additions and 100 deletions

View File

@@ -16,150 +16,88 @@ def flyto(x, y):
goto(x, y)
pendown()
def black_row(times):
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
pendown()
def blue_row(times):
sizes = [50,50,50,50]
for size in sizes:
blue_coin(25)
penup()
forward(size * 2)
def red_row(times):
sizes = [50,50,50,50]
for size in sizes:
red_coin(25)
penup()
forward(size * 2)
penup()
goto(-300, 200)
pendown()
board(400)
"first row"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
pendown()
black_row(1)
flyto(-300, 150)
forward(50)
"second row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
black_row(1)
flyto(-300, 100)
"third row - black tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
pendown()
black_row(1)
flyto(-300, 50)
forward(50)
"fourth row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
black_row(1)
flyto(-300, 0)
"five row - black tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
pendown()
black_row(1)
flyto(-300, -50)
forward(50)
"six row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
black_row(1)
flyto(-300, -100)
"seven row - black tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
pendown()
black_row(1)
flyto(-300, -150)
forward(50)
"eight row - white tile first"
sizes = [50,50,50,50]
for size in sizes:
begin_fill()
fillcolor('black')
black_tile(size)
end_fill()
penup()
forward(size * 2)
black_row(1)
flyto(-300, -200)
"blue checkers piece"
forward(75)
sizes = [50,50,50,50]
for size in sizes:
blue_coin(25)
penup()
forward(size * 2)
blue_row(1)
flyto(-300, -150)
forward(25)
sizes = [50,50,50,50]
for size in sizes:
blue_coin(25)
penup()
forward(size * 2)
blue_row(1)
flyto(-300, 100)
"red checkers piece"
forward(75)
sizes = [50,50,50,50]
for size in sizes:
red_coin(25)
penup()
forward(size * 2)
red_row(1)
flyto(-300, 150)
forward(25)
sizes = [50,50,50,50]
for size in sizes:
red_coin(25)
penup()
forward(size * 2)
red_row(1)
flyto(-300, 200)
input()