import random


def get_best_move(board, scores):
    """
    Finds empty squares with maximum score and randomly returns one
    """
    #Create list of empty coordinates and their scores
    scores_of_empties = []
    for empty in list(board.get_empty_squares()):
        scores_of_empties.append(((scores[empty[0]][empty[1]]) , (empty[0], empty[1])))
    #Determine the highest score
    max_score = max(scores_of_empties)[0]
    #Create list of best options for next move
    move_options = []
    for empty_score in list(scores_of_empties):
        if empty_score[0] == max_score:
            move_options.append(empty_score[1])
    #Select tuple coordinates randomly from empty squares with highest score
    return random.choice(move_options)