/**
 * This function takes a list of scores and a new score as input parameters. It updates the scores list by adding the new score to the existing scores and returns the updated list.
 *
 * @param scores A list of scores.
 * @param newScore The new score to be added.
 * @return The updated list of scores.
 */
fun updatePlayerScore(scores: MutableList<Int>, newScore: Int): List<Int> {

    // Add the new score to the existing scores list
    scores.add(newScore)

    // Sort the scores list in descending order
    scores.sortDescending()

    // Remove the lowest score from the list if the length exceeds 5
    if (scores.size > 5) {
        scores.removeAt(5)
    }

    return scores
}
/**
 * This function takes a list of scores and a new score as input parameters. It updates the scores list by adding the new score to the existing scores and returns the updated list.
 *
 * @param scores A list of scores.
 * @param newScore The new score to be added.
 * @return The updated list of scores.
 */
fun updatePlayerScore(scores: MutableList<Int>, newScore: Int): List<Int> {
/**
 * This function takes a list of scores and a new score as input parameters. It updates the scores list by adding the new score to the existing scores and returns the updated list.
 *
 * @param scores A list of scores.
 * @param newScore The new score to be added.
 * @return The updated list of scores.
 */
fun updatePlayerScore(scores: MutableList<Int>, newScore: Int): List<Int> {

    // Add the new score to the existing scores list
    scores.add(newScore)

    // Sort the scores list in descending order
    scores.sortDescending()

    // Remove the lowest score from the list if the length exceeds 5
    if (scores.size > 5) {
        scores.removeAt(5)
    }

    return scores
}