Exemplo n.º 1
0
 def test_only_edges_does_not_make_a_winner(self):
     game = ConnectGame("""O O O X
             X . . X
              X . . X
               X O O O""")
     winner = game.get_winner()
     self.assertEqual(winner, "")
Exemplo n.º 2
0
 def test_an_empty_board_has_no_winner(self):
     game = ConnectGame(""". . . . .
             . . . . .
              . . . . .
               . . . . .
                . . . . .""")
     winner = game.get_winner()
     self.assertEqual(winner, "")
Exemplo n.º 3
0
 def test_x_wins_using_a_convoluted_path(self):
     game = ConnectGame(""". X X . .
             X . X . X
              . X . X .
               . X X . .
                O O O O O""")
     winner = game.get_winner()
     self.assertEqual(winner, "X")
Exemplo n.º 4
0
 def test_o_wins_crossing_from_top_to_bottom(self):
     game = ConnectGame(""". O . .
             O X X X
              O O O .
               X X O X
                . O X .""")
     winner = game.get_winner()
     self.assertEqual(winner, "O")
Exemplo n.º 5
0
 def test_x_wins_crossing_from_left_to_right(self):
     game = ConnectGame(""". O . .
             O X X X
              O X O .
               X X O X
                . O X .""")
     winner = game.get_winner()
     self.assertEqual(winner, "X")
Exemplo n.º 6
0
 def test_nobody_wins_crossing_adjacent_angles(self):
     game = ConnectGame("""X . . .
             . X O .
              O . X O
               . O . X
                . . O .""")
     winner = game.get_winner()
     self.assertEqual(winner, "")
Exemplo n.º 7
0
 def test_illegal_diagonal_does_not_make_a_winner(self):
     game = ConnectGame("""X O . .
             O X X X
              O X O .
               . O X .
                X X O O""")
     winner = game.get_winner()
     self.assertEqual(winner, "")
Exemplo n.º 8
0
 def test_x_wins_using_a_spiral_path(self):
     game = ConnectGame("""O X X X X X X X X
             O X O O O O O O O
              O X O X X X X X O
               O X O X O O O X O
                O X O X X X O X O
                 O X O O O X O X O
                  O X X X X X O X O
                   O O O O O O O X O
                    X X X X X X X X O""")
     winner = game.get_winner()
     self.assertEqual(winner, "X")
Exemplo n.º 9
0
 def test_o_can_win_on_a_1x1_board(self):
     game = ConnectGame("""O""")
     winner = game.get_winner()
     self.assertEqual(winner, "O")