/**
 * Check collisions between game objects and the player.
 *
 * Complete the code below to implement collision detection for a game developer.
 * The function should take a list of game objects and the player object as input.
 * For each game object, check if it collides with the player based on their positions.
 * If a collision occurs, print the name of the colliding game object.
 *
 * @param gameObjects A list of game objects with x and y coordinates.
 * @param player A map representing the player object with x and y coordinates.
 */
fun checkCollisions(gameObjects: List<Map<String, Int>>, player: Map<String, Int>) {

    for (gameObject in gameObjects) {
        // Check collision for each game object and the player
        val playerX = player["x"] ?: 0
        val playerY = player["y"] ?: 0
        val gameObjectX = gameObject["x"] ?: 0
        val gameObjectY = gameObject["y"] ?: 0

        if (playerX == gameObjectX && playerY == gameObjectY) {
            println("Collision occurred with ${gameObject["name"]}")
        } else if (playerX == gameObjectX) {
            println("Possible collision with ${gameObject["name"]}. Check the y-coordinate.")
        } else if (playerY == gameObjectY) {
            println("Possible collision with ${gameObject["name"]}. Check the x-coordinate.")
        }
    }
}
/**
 * Check collisions between game objects and the player.
 *
 * Complete the code below to implement collision detection for a game developer.
 * The function should take a list of game objects and the player object as input.
 * For each game object, check if it collides with the player based on their positions.
 * If a collision occurs, print the name of the colliding game object.
 *
 * @param gameObjects A list of game objects with x and y coordinates.
 * @param player A map representing the player object with x and y coordinates.
 */
fun checkCollisions(gameObjects: List<Map<String, Int>>, player: Map<String, Int>) {
/**
 * Check collisions between game objects and the player.
 *
 * Complete the code below to implement collision detection for a game developer.
 * The function should take a list of game objects and the player object as input.
 * For each game object, check if it collides with the player based on their positions.
 * If a collision occurs, print the name of the colliding game object.
 *
 * @param gameObjects A list of game objects with x and y coordinates.
 * @param player A map representing the player object with x and y coordinates.
 */
fun checkCollisions(gameObjects: List<Map<String, Int>>, player: Map<String, Int>) {

    for (gameObject in gameObjects) {
        // Check collision for each game object and the player
        val playerX = player["x"] ?: 0
        val playerY = player["y"] ?: 0
        val gameObjectX = gameObject["x"] ?: 0
        val gameObjectY = gameObject["y"] ?: 0

        if (playerX == gameObjectX && playerY == gameObjectY) {
            println("Collision occurred with ${gameObject["name"]}")
        } else if (playerX == gameObjectX) {
            println("Possible collision with ${gameObject["name"]}. Check the y-coordinate.")
        } else if (playerY == gameObjectY) {
            println("Possible collision with ${gameObject["name"]}. Check the x-coordinate.")
        }
    }
}