アットウィキロゴ

ばくぐkpp

import game
 
def decode_mode(ha):
 
        mode=""
        m1=ha[0:1]
        if m1=="w":mode="先手"
        if m1=="x":mode="後手"   
        if m1=="y":mode="先手勝利"
        if m1=="z":mode="後手勝利"
 
        return mode
 
def hash(m1,h1,p1):
 
        ha=""
        if m1=="先手":ha=ha+"w"
        if m1=="後手":ha=ha+"x"   
        if m1=="先手勝利":ha=ha+"y"
        if m1=="後手勝利":ha=ha+"z"
 
        for h2 in h1:
            if h2=="先手":ha=ha+"p"
            if h2=="後手":ha=ha+"q"   
 
        alp=["a","b","c","d","e","f","g","h","i","j"]
        for p2 in p1:
            ha=ha+alp[p2]
 
        return ha 
 
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="先手"
 
h=hash(mode,hand,pos)
 
sub=game.game()
sub.hashx=h
sub.ban=ban
sub.koma=koma
sub.makedata()
pol_hash=sub.pol_hash
 
for h1 in pol_hash:
    mode=decode_mode(h1)
    z=0
    if mode=="先手勝利":z=100
    if mode=="後手勝利":z=100
    if z<50:
       sub=game.game()
       sub.hashx=h1
       sub.ban=ban
       sub.koma=koma
       sub.makedata()
       pol_hash=sub.pol_hash 
       print(pol_hash)
 
最終更新:2018年02月28日 09:51