/**
 * This function takes in the site name and the duration of the archaeological dig and returns the total number of relics found.
 *
 * @param site The name of the archaeological site.
 * @param digDuration The duration of the dig in weeks.
 * @return The total number of relics found.
 */
fun findRelics(site: String, digDuration: Int): Int {

    var relics: Int? = null  // variable to store the total number of relics found

    // TODO: Implement code to find relics using a loop

    // Define a list of layers in the site
    val layers = listOf("upper", "middle", "lower")

    // Iterate over each layer
    for (layer in layers) {
        println("Digging in $site layer: $layer")

        // Assume that the number of relics found in each layer is null initially
        var relicsInLayer: Int? = null

        // Prompt the user to input the number of relics found in the current layer
        println("Enter the number of relics found in $layer layer:")
        relicsInLayer = readLine()?.toIntOrNull() ?: 0

        // TODO: Check if relics is still null and update it accordingly by adding the relicsInLayer value
        relics = relics ?: 0
        relics = relics?.plus(relicsInLayer)
    }

    return relics ?: 0
}
/**
 * This function takes in the site name and the duration of the archaeological dig and returns the total number of relics found.
 *
 * @param site The name of the archaeological site.
 * @param digDuration The duration of the dig in weeks.
 * @return The total number of relics found.
 */
fun findRelics(site: String, digDuration: Int): Int {
/**
 * This function takes in the site name and the duration of the archaeological dig and returns the total number of relics found.
 *
 * @param site The name of the archaeological site.
 * @param digDuration The duration of the dig in weeks.
 * @return The total number of relics found.
 */
fun findRelics(site: String, digDuration: Int): Int {

    var relics: Int? = null  // variable to store the total number of relics found

    // TODO: Implement code to find relics using a loop

    // Define a list of layers in the site
    val layers = listOf("upper", "middle", "lower")

    // Iterate over each layer
    for (layer in layers) {
        println("Digging in $site layer: $layer")

        // Assume that the number of relics found in each layer is null initially
        var relicsInLayer: Int? = null

        // Prompt the user to input the number of relics found in the current layer
        println("Enter the number of relics found in $layer layer:")
        relicsInLayer = readLine()?.toIntOrNull() ?: 0

        // TODO: Check if relics is still null and update it accordingly by adding the relicsInLayer value
        relics = relics ?: 0
        relics = relics?.plus(relicsInLayer)
    }

    return relics ?: 0
}