def test__game_ended_row_check_when_game_not_ended_board_empty(self): env = Environment(3, 3) if_game_ended = env._game_ended_row_check() env.print_array(env.board) self.assertEqual(False, if_game_ended)
def test_game_ended_when_not_ended(self): env = Environment(2, 2) env.print_array(env.board) game_ended = env.check_game_ended() self.assertEqual(False, game_ended)
def test__draw_check_when_draw(self): env = Environment(3, 3) env.board.fill(1) env.set_o(1, 1) env.print_array(env.board) env._draw_check() self.assertEqual(True, env.draw)
def test__game_ended_row_check_when_game_not_ended(self): env = Environment(3, 3) env.set_o(0, 0) env.set_o(0, 1) env.set_x(0, 2) if_game_ended = env._game_ended_row_check() env.print_array(env.board) self.assertEqual(False, if_game_ended)
def test__draw_check_when_no_draw(self): env = Environment(3, 3) env.set_x(0, 0) env.set_x(1, 0) env.set_o(2, 0) env.print_array(env.board) env._draw_check() self.assertEqual(False, env.draw)
def test_game_ended_when_x_has_won_(self): env = Environment(3, 3) env.set_x(0, 0) env.set_x(1, 0) env.set_x(2, 0) env.print_array(env.board) game_ended = env.check_game_ended(force_recalculate=True) self.assertEqual(True, game_ended)
def test2__game_ended_diagonal_check_on_12x12_board(self): env = Environment(12, 12) env.set_o(4, 4) env.set_o(5, 5) env.set_o(6, 6) env.print_array(env.board) if_game_ended = env._game_ended_diagonal_check() self.assertEqual(True, if_game_ended)
def test__game_ended_diagonal_check_on_12x12_board(self): env = Environment(12, 12) env.set_o(9, 2) env.set_o(10, 1) env.set_o(11, 0) env.print_array(env.board) if_game_ended = env._game_ended_diagonal_check() self.assertEqual(True, if_game_ended)
def test__game_ended_diagonal_check_when_not_ended_on_4x4_board(self): env = Environment(4, 4) env.set_o(0, 0) env.set_o(2, 2) env.set_o(3, 3) env.print_array(env.board) if_game_ended = env._game_ended_diagonal_check() self.assertEqual(False, if_game_ended)
def test2__game_ended_diagonal_check_when_ended_right_to_left_on_4x4_board(self): env = Environment(4, 4) env.set_o(1, 2) env.set_o(2, 1) env.set_o(3, 0) env.print_array(env.board) if_game_ended = env._game_ended_diagonal_check() self.assertEqual(True, if_game_ended)
def test__game_ended_diagonal_check_when_ended_left_to_right(self): env = Environment(3, 3) env.set_x(0, 0) env.set_x(1, 1) env.set_x(2, 2) env.print_array(env.board) if_game_ended = env._game_ended_diagonal_check() self.assertEqual(True, if_game_ended)
def test__game_ended_column_check_when_game_not_ended_4x3_board(self): env = Environment(4, 3) env.set_o(0, 1) env.set_o(2, 1) env.set_o(3, 1) env.print_array(env.board) if_game_ended = env._game_ended_column_check() self.assertEqual(False, if_game_ended)
def test__game_ended_row_check_when_game_not_ended_on4x4_board(self): env = Environment(4, 4) env.set_o(2, 0) env.set_o(2, 2) env.set_o(2, 3) if_game_ended = env._game_ended_row_check() env.print_array(env.board) self.assertEqual(False, if_game_ended)