def test_incomplete_game(self): test_game = CheckersGame( CheckerBoardFactory.build_board_from_preset( CheckerBoardTestPresets.simple_tie_test_board)) test_game.board.set_up_pieces([], [(5, 5)]) test_game.switch_team_turn() self.assertEqual(test_game.end_game().value, 'incomplete game')
def test_potential_capture_added_when_blocking_piece_is_removed(self): test_board = CheckerBoardFactory.build_board_from_preset( BoardPresetDataclass(8, 8, [(1, 0), (3, 2)], [(2, 1), (2, 3)])) test_game = CheckersGame(test_board) test_game.switch_team_turn() test_game.make_move(CheckersMove([2, 3, 4, 1])) self.assertEqual(test_game.current_team, TeamEnum.white) self.assertIn(CheckersMove([1, 0, 3, 2]), test_game.possible_capture_moves[TeamEnum.white])
def test_extensive_possible_captures(self): test_board = CheckerBoardFactory.build_board_from_preset( BoardPresetDataclass(8, 8, [(7, 2), (6, 3), (4, 3), (3, 2), (2, 3)], [(5, 4), (4, 5), (5, 6), (6, 5)])) test_game = CheckersGame(test_board) test_game.switch_team_turn() test_game.make_move(CheckersMove([4, 5, 3, 4])) self.assertEqual(test_game.current_team, TeamEnum.white) white_potential_captures = [[6, 3, 4, 5], [4, 3, 2, 5], [2, 3, 4, 5]] black_potential_captures = [[3, 4, 1, 2], [3, 4, 5, 2]] for move in create_move_iterator_from_list_of_lists( white_potential_captures): self.assertIn(move, test_game.possible_capture_moves[TeamEnum.white]) for move in create_move_iterator_from_list_of_lists( black_potential_captures): self.assertIn(move, test_game.possible_capture_moves[TeamEnum.black])