def generate_tree(possible_moves, depth, maxdepth, game_so_far):
    tree = []
    for move in possible_moves:
        move_profile = [move]
        game2 = game_so_far.copy()
        game2.append(move)
        move_profile.append(score(game2))
        if depth < maxdepth:
            possible_moves2 = possible_moves.copy()
            possible_moves2.remove(move)
            move_profile.append(generate_tree(possible_moves2, depth + 1, maxdepth, game2))
        else:
            move_profile.append([])
        tree.append(move_profile)
    return(tree)
