Beispiel #1
0
 def test_get_win_horizontal_win(self):
     board = Board()
     player = "X"
     moves = ["A1", "A2", "A3"]
     for move in moves:
         board.make_move(move, player)
     self.assertEqual(player, board.get_win(), "Game should be won by X.")
Beispiel #2
0
 def test_get_win_diagonal_win(self):
     board = Board()
     player = "X"
     moves = ["A3", "B2", "C1"]
     for move in moves:
         board.make_move(move, player)
     self.assertEqual(player, board.get_win(), "Game should be won by X.")
Beispiel #3
0
 def test_get_win_no_win(self):
     board = Board()
     player = "X"
     moves = ["A1", "B1", "C3"]
     for move in moves:
         board.make_move(move, player)
     self.assertFalse(board.get_win(), "Game should not be won yet.")
Beispiel #4
0
 def test_get_win_tie(self):
     board = Board()
     player_one = "X"
     player_two = "O"
     moves_one = ["B2", "A2", "B1", "A3", "C3"]
     moves_two = ["A1", "C2", "B3", "C1"]
     for move in moves_one:
         board.make_move(move, player_one)
     for move in moves_two:
         board.make_move(move, player_two)
     self.assertEqual(board.TIE_TOKEN, board.get_win(),
                      "Game should be a tie.")