-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.py
27 lines (24 loc) · 925 Bytes
/
player.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Player(object):
#Player base class
def __init__(self, color=None):
"""
Get current player state
:param color: If color=='X', it means black is on the side; color=='O', it means white.
"""
self.color = color
def get_move(self, board):
"""
Obtain the coordinates of the best move position based on the current chessboard
:param board: current board
:return: position coordinates of the move
"""
pass
def move(self, board, action):
"""
Drop a chess piece, the coordinates of the chess piece dropped by the root piece get the coordinate list of the reverse chess piece
:param board: board
:param action: the coordinates of the dropped piece
:return: Reverse the list of pawn coordinates
"""
flipped_pos = board._move(action, self.color)
return flipped_pos