示例#1
0
 def test_best_move(self):
     my_board = TTTBoard(3, board = [[2, 3, 2], [1, 1, 1], [1, 2, 3]])
     scores = [[3.0, 5.0, -1.0], [3.0, 2.0, -8.0], [4.0, -2.0, 2.0]]
     print my_board
     print "scores:", scores
     self.assertEqual(get_best_move(my_board, scores), (2, 0))
     self.assertIs(type(get_best_move(my_board, scores)), tuple)
示例#2
0
 def test_three_best_moves(self):
     my_board = TTTBoard(3, board = [[1, 3, 2], [1, 3, 1], [2, 2, 1]])
     scores = [[2.0, 2.0, 2.0], [2.0, 2.0, -1.0], [2.0, -2.0, 2.0]]
     print '\n', my_board
     print "scores:", scores
     possible_squares = ((0, 0), (1, 0), (2, 2))
     assert get_best_move(my_board, scores) in possible_squares