datatransfer.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:BetaElephant 作者: milkpku 项目源码 文件源码
def move(cstate, move):
    '''
    move the chess according to the move action
    state: the current chessborad, numpy.array[10][9], dtype=string_
    move: the action to move, string format as:'D5-E5'
    '''
    src = []
    des = []
    src.append(9 - int(move[1]))
    src.append(ord(move[0]) - ord('A'))
    des.append(9 - int(move[4]))
    des.append(ord(move[3]) - ord('A'))
    # print src, des
    chess = cstate.state[src[0]][src[1]]
    cstate.state[src[0]][src[1]] = ' '
    cstate.state[des[0]][des[1]] = chess
    cstate.roundcnt += 1
    if cstate.turn == 'b':
        cstate.turn = 'w'
    else:
        cstate.turn = 'b'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号