Exemplo n.º 1
0
 def test_minimax_1(self):
     t = TTT(3)
     state = [[1, -1, 0], [-1, 1, 0], [0, 0, 0]]
     state = np.array(state, dtype='int')
     state = state.reshape(-1)
     t._state = state
     [score, move] = minimax(t.get_state(), 1, t)
     self.assertListEqual(list(state), list(t.get_state()))
     self.assertEqual(8, move)
     self.assertEqual(5, score)
Exemplo n.º 2
0
 def test_alpha_beta_1(self):
     t = TTT(3)
     player = ABPruning(3)
     state = [[1, -1, 0], [-1, 1, 0], [0, 0, 0]]
     state = np.array(state, dtype='int')
     state = state.reshape(-1)
     t._state = state
     [score, move] = player.get(t.get_state(), 1)
     self.assertListEqual(list(state), list(t.get_state()))
     self.assertEqual(8, move)
     self.assertEqual(5, score)