I am making a board game with a computer player. The game is on a 6x6 grid. It's like chess but with pawns only. Each player has 6 pawns; one player is circles and one is crosses. The goal is to be the first player to reach the other side of the board.
Each move is either one step forward, or a "jump" on a diagonal over a piece. When a jump is made over the opponent's piece, it is captured and removed from the board.
So far, I have written the code to initialise the board and to evaluate a position:
class SimpleBoardPlayer(BoardComputerPlayer): def __init__(self, the_mark): ''' Constructor :param compatibility_score_set: ''' super(SimpleBoardPlayer, self).__init__(the_mark) self.name = "Simple" def evaluate_game_status(self, a_board): GAMESIZE = 6 CROSS = 'X' RING = '0' max_cross_row = 0 max_ring_row = GAMESIZE-1 for i in range(GAMESIZE): for j in range(GAMESIZE): if a_board.the_grid[i][j] == CROSS: if i > max_cross_row: max_cross_row = i if a_board.the_grid[i][j] == RING: if i < max_ring_row: max_ring_row = i score = 0 if self.mark == CROSS: score = max_cross_row - (GAMESIZE-1-max_ring_row) if self.mark == RING: score = (GAMESIZE-1-max_ring_row) - max_cross_row return score