/**
 * This function calculates the amount of wood needed for each task in the given list
 * based on the available materials provided. It appends the calculated values to a list.
 *
 * @param tasks A list containing the names of the tasks (strings)
 * @param materials A list of available materials (strings)
 * @return A list of the amount of wood needed for each task in the same order as the tasks list
 */
fun calculateWoodNeeded(tasks: List<String>, materials: List<String>): List<Int> {

    val woodNeeded = mutableListOf<Int>()  // List to store the calculated wood needed for each task

    for (task in tasks) {
        if (task !in materials) {  // Check if the task can be completed
            // Append 0 to indicate that no wood is needed
            woodNeeded.add(0)
        } else {
            // Randomly generate the amount of wood needed for the task
            // between 1 and 100 (inclusive)
            // Coded in very difficult level to make it challenging for the Carpenter
            woodNeeded.add((1..(100 - tasks.size) * (materials.size - 1)).random())
        }
    }

    return woodNeeded
}
/**
 * This function calculates the amount of wood needed for each task in the given list
 * based on the available materials provided. It appends the calculated values to a list.
 *
 * @param tasks A list containing the names of the tasks (strings)
 * @param materials A list of available materials (strings)
 * @return A list of the amount of wood needed for each task in the same order as the tasks list
 */
fun calculateWoodNeeded(tasks: List<String>, materials: List<String>): List<Int> {
/**
 * This function calculates the amount of wood needed for each task in the given list
 * based on the available materials provided. It appends the calculated values to a list.
 *
 * @param tasks A list containing the names of the tasks (strings)
 * @param materials A list of available materials (strings)
 * @return A list of the amount of wood needed for each task in the same order as the tasks list
 */
fun calculateWoodNeeded(tasks: List<String>, materials: List<String>): List<Int> {

    val woodNeeded = mutableListOf<Int>()  // List to store the calculated wood needed for each task

    for (task in tasks) {
        if (task !in materials) {  // Check if the task can be completed
            // Append 0 to indicate that no wood is needed
            woodNeeded.add(0)
        } else {
            // Randomly generate the amount of wood needed for the task
            // between 1 and 100 (inclusive)
            // Coded in very difficult level to make it challenging for the Carpenter
            woodNeeded.add((1..(100 - tasks.size) * (materials.size - 1)).random())
        }
    }

    return woodNeeded
}