import sho
import time
import tkinter
def faststep():
global mode
global hand
global pos
pos=[2,1,3,8,7,9]
hand=["先手","先手","先手","後手","後手","後手"]
mode="先手"
root = tkinter.Tk()
root.title("将棋")
root.geometry("500x500")
can = tkinter.Canvas(root, width = 300, height = 300)
can.place(x=0, y=0)
koma=["王","金","銀","王","金","銀"]
ban=[]
ban.append([0,0])
for y1 in [1,2,3]:
for x1 in [1,2,3]:
ban.append([x1,y1])
pos=[2,1,3,8,7,9]
hand=["先手","先手","先手","後手","後手","後手"]
mode="先手"
tr=0
while tr<50:
tr=tr+1
time.sleep(1.2)
if mode=="先手":
can.create_rectangle(0, 0, 300, 300, fill = 'green')
if mode=="後手":
can.create_rectangle(0, 0, 300, 300, fill = 'blue')
sub=sho.sho()
sub.pos=pos
sub.hand=hand
sub.mode=mode
sub.koma=koma
sub.ban=ban
sub.makedata()
pos=sub.pos
hand=sub.hand
mode=sub.mode
for i in range(6):
p1=pos[i]
x1=100*ban[p1][0]-50
y1=100*ban[p1][1]-50
if p1>0:can.create_text(x1, y1,font=("",50), text = koma[i])
can.pack()
can.update()
print(mode)
if mode=="先手勝利":faststep()
if mode=="後手勝利":faststep()
root.mainloop()
最終更新:2018年02月05日 11:46