예제 #1
0
    def test_make_move_white(self):
        player = 'w'
        start = 1
        modifier = utils.player_modifier(player)

        board_start = config.INIT_BOARD.copy()

        board_end = config.INIT_BOARD.copy()
        board_end[start] -= modifier
        board_end[start + modifier] += modifier

        self.assertEqual(utils.make_move(board_start, start, 1, player),
                board_end)
예제 #2
0
def tactic_doors(board, player):
    modifier = player_modifier(player)
    result = 0

    player_singles = 0
    enemy_singles = 0

    for k in board[1:25]:
        if k == modifier:
            player_singles += 1
        elif k == -modifier:
            enemy_singles += 1

    result -= player_singles - enemy_singles

    return result / 15
예제 #3
0
def tactic_push_forward(board, player):
    modifier = player_modifier(player)
    result = 0

    player_checkers = 0
    enemy_checkers = 0
    push_forward = 0

    for i, k in enumerate(board):
        if player_from_number(k) == player:
            push_forward += ((26 + modifier * i) % 26) * k / 28
            player_checkers += k
        elif player_from_number(k) == enemy(player):
            enemy_checkers += k
            push_forward -= ((26 + modifier * i) % 26) * k / 28

    push_forward -= player_checkers + enemy_checkers

    result += push_forward

    return result / 15
예제 #4
0
 def test_player_modifier(self):
     self.assertEqual(utils.player_modifier('w'), 1)
     self.assertEqual(utils.player_modifier('b'), -1)