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,0,8,7,9]
hand=["先手","先手","先手","後手","後手","後手"]
mode="先手"
sub=sho.sho()
sub.pos=pos
sub.hand=hand
sub.mode=mode
sub.ban=ban
sub.koma=koma
sig=sub.policy()
pos_pol=[]
hand_pol=[]
for q in sig:
ch=sub.check(q)
if ch<50:
pos_pol.append(q)
hand_pol.append(hand)
pos_sum=[]
hand_sum=[]
for i in range(len(pos_pol)):
pos_chx=pos_pol[i]
hand_chx=hand_pol[i]
sub.hand_chx=hand_chx
sub.pos_chx=pos_chx
sub.change()
hand_chx=sub.hand_chx
pos_chx=sub.pos_chx
pos_sum.append(pos_chx)
hand_sum.append(hand_chx)
print(pos_sum)
print(hand_sum)
koma_sel=sub.select_b()
for k1 in koma_sel:
sig=sub.makeput()
for si in sig:
pos_q=[]
hand_q=[]
for i in range(6):
pos_q.append(pos[i])
pos_q[k1]=si
pos_sum.append(pos_q)
hand_sum.append(hand)
print(pos_sum)
print(hand_sum)
z=range(len(pos_sum))
num=np.random.choice(z)
print(num)
for i in range(6):
pos[i]=pos_sum[num][i]
hand[i]=hand_sum[num][i]
print(pos)
print(hand)
最終更新:2018年01月16日 05:38