/**
 * This function takes a game map, which is a list of lists representing the game grid,
 * and returns a list of the game objects present at the intersection of the row and column.
 *
 * Each game object is represented by an integer:
 * - 0 indicates an empty space
 * - Positive integers represent different game objects
 *
 * Your task is to implement the accessGameObjects function and return a list of the game objects present at the
 * intersection of the given row and column. If the row or column is out of bounds, return an empty list.
 *
 * Example:
 * gameMap = listOf(
 *     listOf(0, 1, 2),
 *     listOf(3, 4, 5),
 *     listOf(6, 7, 8)
 * )
 *
 * accessGameObjects(gameMap, 1, 1) should return [4]
 */
fun accessGameObjects(gameMap: List<List<Int>>, row: Int, column: Int): List<Int> {

    val result = mutableListOf<Int>()

    if (row < gameMap.size && column < gameMap[0].size) {
        result.add(gameMap[row][column])
    }

    return result
}
/**
 * This function takes a game map, which is a list of lists representing the game grid,
 * and returns a list of the game objects present at the intersection of the row and column.
 *
 * Each game object is represented by an integer:
 * - 0 indicates an empty space
 * - Positive integers represent different game objects
 *
 * Your task is to implement the accessGameObjects function and return a list of the game objects present at the
 * intersection of the given row and column. If the row or column is out of bounds, return an empty list.
 *
 * Example:
 * gameMap = listOf(
 *     listOf(0, 1, 2),
 *     listOf(3, 4, 5),
 *     listOf(6, 7, 8)
 * )
 *
 * accessGameObjects(gameMap, 1, 1) should return [4]
 */
fun accessGameObjects(gameMap: List<List<Int>>, row: Int, column: Int): List<Int> {
/**
 * This function takes a game map, which is a list of lists representing the game grid,
 * and returns a list of the game objects present at the intersection of the row and column.
 *
 * Each game object is represented by an integer:
 * - 0 indicates an empty space
 * - Positive integers represent different game objects
 *
 * Your task is to implement the accessGameObjects function and return a list of the game objects present at the
 * intersection of the given row and column. If the row or column is out of bounds, return an empty list.
 *
 * Example:
 * gameMap = listOf(
 *     listOf(0, 1, 2),
 *     listOf(3, 4, 5),
 *     listOf(6, 7, 8)
 * )
 *
 * accessGameObjects(gameMap, 1, 1) should return [4]
 */
fun accessGameObjects(gameMap: List<List<Int>>, row: Int, column: Int): List<Int> {

    val result = mutableListOf<Int>()

    if (row < gameMap.size && column < gameMap[0].size) {
        result.add(gameMap[row][column])
    }

    return result
}