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'
评论列表
文章目录