-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.py
49 lines (42 loc) · 1.16 KB
/
GUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import turtle as t
import AI as AI
def init():
screen= t.getscreen()
screen.screensize(800,800)
t.hideturtle()
t.speed(0)
t.tracer(0,5) #changes screen refresh rate
def updateScreen():
t.clear()
colors=['black','white','red']
square(-100,100,80,colors[AI.board[0]+1])
square(0, 100, 80, colors[AI.board[1]+1])
square(100, 100, 80, colors[AI.board[2]+1])
square(0, 0, 80, colors[AI.board[3]+1])
square(-100, 0, 80, colors[AI.board[4]+1])
square(100, 0, 80, colors[AI.board[5]+1])
square(-100, -100, 80, colors[AI.board[6]+1])
square(0, -100, 80, colors[AI.board[7]+1])
square(100, -100, 80, colors[AI.board[8]+1])
#square(-400,350,40,'black')
t.goto(-400,350)
t.color('black')
t.pendown()
t.write("difficulty: "+str(AI.difficulty),False,font=("Verdana",20, "normal"))
t.update()
def square(x,y,size,color,rotation = 0):
t.penup()
t.goto(x,y)
t.pendown()
t.color(color)
t.setheading(rotation)
t.fillcolor(color)
t.begin_fill()
for a in range(4):
t.forward(size)
t.left(90)
t.end_fill()
t.penup()
#init()
#while True:
# updateScreen()