Esempio n. 1
0
 def test_a_horizonal_win_for_p2_and_test_game_state_changes_with_final_move(
         self):
     gb = GameBoard(4, 4, 4)
     gb.grid = [[0], [0], [0], [0]]
     game_state = gb.add_to_column(0, self.p2)
     self.assertEqual(game_state, False)
     game_state = gb.add_to_column(1, self.p2)
     self.assertEqual(game_state, False)
     game_state = gb.add_to_column(2, self.p2)
     self.assertEqual(game_state, False)
     game_state = gb.add_to_column(3, self.p2)
     self.assertEqual(game_state, True)
Esempio n. 2
0
 def test_simple_vertical_win_for_p1(self):
     gb = GameBoard(4, 4, 4)
     gb.grid = [[1, 1, 1], [2, 2, 2], [], []]
     game_state = gb.add_to_column(0, self.p1)
     self.assertEqual(game_state, True)
Esempio n. 3
0
 def test_non_win(self):
     gb = GameBoard(4, 4, 4)
     gb.grid = [[1, 1, 1], [2, 2, 2], [], []]
     game_state = gb.add_to_column(3, self.p1)
     self.assertEqual(game_state, False)
Esempio n. 4
0
 def test_reverse_diagonal_win_for_p1(self):
     gb = GameBoard(4, 4, 4)
     gb.grid = [[0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0]]
     game_state = gb.add_to_column(0, self.p1)
     self.assertEqual(game_state, True)
Esempio n. 5
0
 def test_diagonal_non_win_for_p2(self):
     gb = GameBoard(4, 4, 4)
     gb.grid = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0]]
     game_state = gb.add_to_column(3, self.p2)
     self.assertEqual(game_state, False)
Esempio n. 6
0
 def test_simple_horizonal_win_for_p1(self):
     gb = GameBoard(4, 4, 4)
     gb.grid = [[], [1], [1], [1]]
     game_state = gb.add_to_column(0, self.p1)
     self.assertEqual(game_state, True)