/**
 * This function takes a list of artifacts and a dig site, and returns the artifact index which matches the
 * dig site's requirements. If no artifact matches the requirements, it returns -1.
 *
 * @param artifactsList A list of artifacts, each represented by a triple (name, age, origin).
 * @param digSite The dig site to find a matching artifact for.
 * @return The index of the matching artifact, or -1 if no match is found.
 */
fun findArtifact(artifactsList: List<Triple<String, Int, String>>, digSite: String): Int {

    artifactsList.forEachIndexed { index, artifact ->
        val (name, age, origin) = artifact

        if (name.startsWith(digSite) && age < 100 && "ruins" in origin) {
            return index
        } else if (name.endsWith(digSite) && age >= 100 && "fossils" in origin) {
            return index
        }
    }
    return -1
}
/**
 * This function takes a list of artifacts and a dig site, and returns the artifact index which matches the
 * dig site's requirements. If no artifact matches the requirements, it returns -1.
 *
 * @param artifactsList A list of artifacts, each represented by a triple (name, age, origin).
 * @param digSite The dig site to find a matching artifact for.
 * @return The index of the matching artifact, or -1 if no match is found.
 */
fun findArtifact(artifactsList: List<Triple<String, Int, String>>, digSite: String): Int {
/**
 * This function takes a list of artifacts and a dig site, and returns the artifact index which matches the
 * dig site's requirements. If no artifact matches the requirements, it returns -1.
 *
 * @param artifactsList A list of artifacts, each represented by a triple (name, age, origin).
 * @param digSite The dig site to find a matching artifact for.
 * @return The index of the matching artifact, or -1 if no match is found.
 */
fun findArtifact(artifactsList: List<Triple<String, Int, String>>, digSite: String): Int {

    artifactsList.forEachIndexed { index, artifact ->
        val (name, age, origin) = artifact

        if (name.startsWith(digSite) && age < 100 && "ruins" in origin) {
            return index
        } else if (name.endsWith(digSite) && age >= 100 && "fossils" in origin) {
            return index
        }
    }
    return -1
}