Beispiel #1
0
 def test_get_best_move2(self):
     b = [[False] * 3 for i in range(3)]
     g = hw.DominoesGame(b)
     g.perform_move(0, 1, True)
     self.assertEqual(g.get_best_move(False, 1), ((2, 0), -3, 2))
     self.assertEqual(g.get_best_move(False, 2), ((2, 0), -2, 5))
Beispiel #2
0
 def test_successors2(self):
     b = [[True, False], [True, False]]
     g = hw.DominoesGame(b)
     for m, new_g in g.successors(True):
         print m, new_g.get_board()
Beispiel #3
0
 def test_get_best_move(self):
     b = [[False] * 3 for i in range(3)]
     g = hw.DominoesGame(b)
     self.assertEqual(g.get_best_move(True, 1), ((0, 1), 2, 6))
     self.assertEqual(g.get_best_move(True, 2), ((0, 1), 3, 10))
Beispiel #4
0
 def test_game_over2(self):
     b = [[True, False], [True, False]]
     g = hw.DominoesGame(b)
     self.assertEqual(g.game_over(True), False)
     self.assertEqual(g.game_over(False), True)
Beispiel #5
0
 def test_legal_moves2(self):
     b = [[True, False], [True, False]]
     g = hw.DominoesGame(b)
     self.assertEqual(list(g.legal_moves(True)), [(0, 1)])
     self.assertEqual(list(g.legal_moves(False)), [])
Beispiel #6
0
 def test_is_legal_move2(self):
     b = [[True, False], [True, False]]
     g = hw.DominoesGame(b)
     self.assertEqual(g.is_legal_move(0, 0, False), False)
     self.assertEqual(g.is_legal_move(0, 1, True), True)
     self.assertEqual(g.is_legal_move(1, 1, True), False)
Beispiel #7
0
 def test_reset2(self):
     b = [[True, False], [True, False]]
     g = hw.DominoesGame(b)
     self.assertEqual(g.get_board(), [[True, False], [True, False]])
     g.reset()
     self.assertEqual(g.get_board(), [[False, False], [False, False]])
Beispiel #8
0
 def test_get_board2(self):
     b = [[True, False], [True, False]]
     g = hw.DominoesGame(b)
     self.assertEqual(g.get_board(), [[True, False], [True, False]])