generated from mwc/project_drawing
	I was struggling to figure out how to put the animation code into my code. i had to change up the code for my piece so they were made separate and then move them. it was hard to figure out have to calculate which way the piece would go but i got one to move
		
			
				
	
	
		
			86 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
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()
 | 
						|
 | 
						|
def red_coin(size):
 | 
						|
    begin_fill()
 | 
						|
    fillcolor('red')
 | 
						|
    circle(size)
 | 
						|
    end_fill()
 | 
						|
 | 
						|
 | 
						|
def black_tile(size):
 | 
						|
    "black tile first"
 | 
						|
    repeat = [1, 2, 3, 4]
 | 
						|
    for repeat in repeat:
 | 
						|
        forward(size)
 | 
						|
        right(90)
 | 
						|
 | 
						|
 | 
						|
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 game(times):
 | 
						|
    penup()
 | 
						|
    goto(-300, 200)
 | 
						|
    pendown()
 | 
						|
    board(400)
 | 
						|
 | 
						|
    "first row"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, 150)
 | 
						|
    forward(50)
 | 
						|
 | 
						|
    "second row - white tile first"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, 100)
 | 
						|
 | 
						|
    "third row - black tile first"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, 50)
 | 
						|
    forward(50)
 | 
						|
 | 
						|
    "fourth row - white tile first"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, 0)
 | 
						|
 | 
						|
    "five row - black tile first"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, -50)
 | 
						|
    forward(50)
 | 
						|
 | 
						|
    "six row - white tile first"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, -100)
 | 
						|
 | 
						|
    "seven row - black tile first"
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, -150)
 | 
						|
    forward(50)
 | 
						|
 | 
						|
    "eight row - white tile first"
 | 
						|
    sizes = [50,50,50,50]
 | 
						|
    black_row(1)
 | 
						|
    flyto(-300, -200)
 |