示例#1
0
 def test_ai_player_negamax(self):
     timer = MockTimer()
     chess = MockChess()
     player = AIPlayer(WHITE, timer, chess, EASY)
     player.openings = {}
     player.ai_move()
     self.assertNotEqual(chess.selected, None)
     self.assertEqual(chess.played, True)
示例#2
0
 def test_ai_player_semi_random_move(self):
     timer = MockTimer()
     chess = MockChess()
     player = AIPlayer(WHITE, timer, chess, SEMI_RANDOM)
     openings = player.openings
     player.ai_move()
     self.assertEqual(player.openings, openings)
     self.assertNotEqual(chess.selected, None)
     self.assertEqual(chess.played, True)
示例#3
0
 def test_ai_player_start_turn(self):
     timer = MockTimer()
     chess = MockChess()
     player = AIPlayer(WHITE, timer, chess, RANDOM)
     openings = player.openings
     player.start_turn()
     self.assertEqual(timer.turn_started, True)
     sleep(0.12)
     self.assertEqual(player.openings, openings)
     self.assertNotEqual(chess.selected, None)
     self.assertEqual(chess.played, True)
示例#4
0
 def test_ai_player_deny_draw(self):
     timer = MockTimer()
     chess = MockChess()
     player = AIPlayer(WHITE, timer, chess, RANDOM)
     player.confirm_draw()
     self.assertEqual(chess.draw_denied, player)