def test_check_diagonal_topright_to_bottom_left(self): board = Board() board.insert('X', 4, 0) board.insert('X', 2, 2) checker = LogicChecker(board) board.draw() assert checker._check_diagonal('X', 0, 4) == True
def test_check_diagonal_middle_row_false(self): board = Board() board.insert('X', 0, 0) board.insert('X', 4, 0) checker = LogicChecker(board) board.draw() assert checker._check_diagonal('X', 2, 2) == False
help_board.insert('6', 4, 2) help_board.insert('7', 0, 4) help_board.insert('8', 2, 4) help_board.insert('9', 4, 4) in_handler = InputHandler(help_board, board) """Main Loop""" current_player = 'X' while 1: print("------------------------------------------------") print("\t\tRound ", math.ceil(logic.turn / 2), ":\n\n\tPlayer ", current_player, " - it is your turn.\n") board.draw() player_choice = in_handler.get_player_choice(current_player) if player_choice == 'surrender': break else: board.insert(current_player, *player_choice) if logic.is_this_move_a_victory(current_player, *player_choice): board.draw() print("\n-------------------------------------------------") print("\nPlayer", current_player, "has won after", math.ceil(logic.turn / 2), "rounds!!\nAll hail the victor!\n") print("-------------------------------------------------\n\n") break