/**
 * Function to modify elements in a list of game objects.
 *
 * @param gameObjects A list of game objects.
 * @param elementToModify The element in the game objects to modify.
 * @param newValue The new value to assign to the modified element.
 * @return Modified game objects with the specified element changed to the new value.
 */
fun modifyElements(gameObjects: List<MutableMap<String, Any>>, elementToModify: String, newValue: Any): List<MutableMap<String, Any>> {

    for (obj in gameObjects) {
        if (elementToModify in obj) {
            obj[elementToModify] = newValue
        }
    }
    return gameObjects
}

// Example usage
/**
 * Function to modify elements in a list of game objects.
 *
 * @param gameObjects A list of game objects.
 * @param elementToModify The element in the game objects to modify.
 * @param newValue The new value to assign to the modified element.
 * @return Modified game objects with the specified element changed to the new value.
 */
fun modifyElements(gameObjects: List<MutableMap<String, Any>>, elementToModify: String, newValue: Any): List<MutableMap<String, Any>> {
/**
 * Function to modify elements in a list of game objects.
 *
 * @param gameObjects A list of game objects.
 * @param elementToModify The element in the game objects to modify.
 * @param newValue The new value to assign to the modified element.
 * @return Modified game objects with the specified element changed to the new value.
 */
fun modifyElements(gameObjects: List<MutableMap<String, Any>>, elementToModify: String, newValue: Any): List<MutableMap<String, Any>> {

    for (obj in gameObjects) {
        if (elementToModify in obj) {
            obj[elementToModify] = newValue
        }
    }
    return gameObjects
}

// Example usage