アットウィキロゴ

もでl しょう

import sho
import numpy as np
 
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
 
    sub=sho.sho()
    sub.pos=pos
    sub.hand=hand
    sub.mode=mode
    sub.ban=ban
    sub.koma=koma
    sub.one()
    hand_sum=sub.hand_sum
    pos_sum=sub.pos_sum
 
    sub2=sho.sho()
    sub2.pos=pos
    sub2.hand=hand
    sub2.mode=mode
    sub2.ban=ban
    sub2.koma=koma
    sub2.hand_sum=hand_sum
    sub2.pos_sum=pos_sum
    sub2.two()
    hand_sum=sub2.hand_sum
    pos_sum=sub2.pos_sum
 
    r1=range(len(pos_sum))
    num=np.random.choice(r1)
 
    for i in range(6): 
        pos[i]=pos_sum[num][i]
        hand[i]=hand_sum[num][i]
 
    print(pos)
    print(hand)
 
    sub3=sho.sho()
    sub3.mode=mode
    sub3.hand=hand
    sub3.win()
    mode=sub3.mode
 
    print(mode)
 
    if mode=="先手勝利":
       tr=100
    if mode=="後手勝利":
       tr=100
 
最終更新:2018年01月17日 12:27