/**
 * This function removes elements from a list of game objects, based on a given list of objects to remove.
 *
 * @param gameObjects A list of game objects.
 * @param objectsToRemove A list of objects to remove from the gameObjects list.
 * @return The updated gameObjects list after removing the specified objects.
 *
 * Example:
 * val gameObjects = mutableListOf("player", "enemy", "powerup", "obstacle")
 * val objectsToRemove = listOf("enemy", "powerup")
 * removeElements(gameObjects, objectsToRemove)
 * Output: ['player', 'obstacle']
 */
fun removeElements(gameObjects: MutableList<String>, objectsToRemove: List<String>): MutableList<String> {

    for (objectToRemove in objectsToRemove) {
        if (objectToRemove !in gameObjects) {
            throw IllegalArgumentException("$objectToRemove is not in the gameObjects list.")
        } else {
            gameObjects.removeAll { it == objectToRemove }
        }
    }
    return gameObjects
}
/**
 * This function removes elements from a list of game objects, based on a given list of objects to remove.
 *
 * @param gameObjects A list of game objects.
 * @param objectsToRemove A list of objects to remove from the gameObjects list.
 * @return The updated gameObjects list after removing the specified objects.
 *
 * Example:
 * val gameObjects = mutableListOf("player", "enemy", "powerup", "obstacle")
 * val objectsToRemove = listOf("enemy", "powerup")
 * removeElements(gameObjects, objectsToRemove)
 * Output: ['player', 'obstacle']
 */
fun removeElements(gameObjects: MutableList<String>, objectsToRemove: List<String>): MutableList<String> {
/**
 * This function removes elements from a list of game objects, based on a given list of objects to remove.
 *
 * @param gameObjects A list of game objects.
 * @param objectsToRemove A list of objects to remove from the gameObjects list.
 * @return The updated gameObjects list after removing the specified objects.
 *
 * Example:
 * val gameObjects = mutableListOf("player", "enemy", "powerup", "obstacle")
 * val objectsToRemove = listOf("enemy", "powerup")
 * removeElements(gameObjects, objectsToRemove)
 * Output: ['player', 'obstacle']
 */
fun removeElements(gameObjects: MutableList<String>, objectsToRemove: List<String>): MutableList<String> {

    for (objectToRemove in objectsToRemove) {
        if (objectToRemove !in gameObjects) {
            throw IllegalArgumentException("$objectToRemove is not in the gameObjects list.")
        } else {
            gameObjects.removeAll { it == objectToRemove }
        }
    }
    return gameObjects
}