from turtle import * |
speed( 0 ) |
pensize( 5 ) |
def 棋盘(): |
for i in range ( 1 , 3 ): |
pu() |
goto( 0 ,i * 50 ) |
pd() |
seth( 0 ) |
fd( 150 ) |
pu() |
goto(i * 50 , 0 ) |
pd() |
seth( 90 ) |
fd( 150 ) |
棋盘() |
def O(x,y): |
x = x - x % 50 + 25 |
y = y - y % 50 + 25 |
pu() |
goto(x,y) |
pd() |
dot( 40 , 'black' ) |
dot( 34 , 'white' ) |
def X(x,y): |
x = x - x % 50 + 25 |
y = y - y % 50 + 25 |
pu() |
goto(x,y) |
pd() |
seth( 45 ) |
for i in range ( 4 ): |
fd( 20 ) |
fd( - 20 ) |
left( 90 ) |
def mid(x,y): |
clear() |
棋盘() |
onscreenclick(O) |
onscreenclick(X, 3 ) |
onscreenclick(mid, 2 ) |
done() |