Ejemplo n.º 1
0
 def test_board_gets_updated_and_shows_win(self):
     easy_win = {1:"o", 2:"o"}
     WIN_MOVE = 3
     board = BaseBoard(3)
     generator = MoveGenerator(board)
     self.assertEqual(WIN_MOVE, generator.next_move(easy_win))
     self.assertEqual( {1:"o",2:"o",3:"o"}, board.state())
Ejemplo n.º 2
0
 def test_board_gets_updated_and_shows_win(self):
     easy_win = {1: "o", 2: "o"}
     WIN_MOVE = 3
     board = BaseBoard(3)
     generator = MoveGenerator(board)
     self.assertEqual(WIN_MOVE, generator.next_move(easy_win))
     self.assertEqual({1: "o", 2: "o", 3: "o"}, board.state())
Ejemplo n.º 3
0
 def test_state_returns_only_non_junk(self):
     garbage_state = {0:"", 5:"o", 6:"x", 9:"x"}
     board = BaseBoard(3)
     board.board_state = garbage_state
     self.assertEqual( {5:"o", 6:"x", 9:"x"}, board.state())
Ejemplo n.º 4
0
 def test_make_move(self):
     board = BaseBoard(3)
     board.make_move(1,"x")
     self.assertEqual({1:"x"},board.state())
Ejemplo n.º 5
0
 def test_set_state(self):
     board = BaseBoard(3)
     self.assertEqual({},board.state())
     board.set_state({1:"x"})
     self.assertEqual({1:"x"},board.state())
Ejemplo n.º 6
0
 def test_erase_move(self):
     board = BaseBoard(base=2)
     board.make_move(3,"x")
     board.erase_move(3)
     self.assertEqual({},board.state())