/**
 * Farmer is harvesting crops from the field and storing them in different baskets.
 *
 * @param basket A dictionary representing the different baskets to store crops. The keys represent the names
 *               of the baskets and the values represent the crops stored in them.
 * @param field A list representing a field with different crop rows.
 * @param index An integer representing the index of the crop row to harvest.
 * @return A string indicating the result of the harvest operation. If successful, it will return "Harvest successful!",
 *         otherwise it will return an error message.
 */
fun harvestCrops(basket: Map<String, Any>, field: List<Map<String, Any>>, index: Int): String {

    return try {
        val cropRow = field[index]
        val basketName = cropRow["basket"] as String
        "Harvest successful!"
    } catch (e: IndexOutOfBoundsException) {
        "Invalid index! The specified crop row does not exist."
    } catch (e: ClassCastException) {
        "Invalid crop row! The crop row does not have a 'basket' key"
    }
}
/**
 * Farmer is harvesting crops from the field and storing them in different baskets.
 *
 * @param basket A dictionary representing the different baskets to store crops. The keys represent the names
 *               of the baskets and the values represent the crops stored in them.
 * @param field A list representing a field with different crop rows.
 * @param index An integer representing the index of the crop row to harvest.
 * @return A string indicating the result of the harvest operation. If successful, it will return "Harvest successful!",
 *         otherwise it will return an error message.
 */
fun harvestCrops(basket: Map<String, Any>, field: List<Map<String, Any>>, index: Int): String {
/**
 * Farmer is harvesting crops from the field and storing them in different baskets.
 *
 * @param basket A dictionary representing the different baskets to store crops. The keys represent the names
 *               of the baskets and the values represent the crops stored in them.
 * @param field A list representing a field with different crop rows.
 * @param index An integer representing the index of the crop row to harvest.
 * @return A string indicating the result of the harvest operation. If successful, it will return "Harvest successful!",
 *         otherwise it will return an error message.
 */
fun harvestCrops(basket: Map<String, Any>, field: List<Map<String, Any>>, index: Int): String {

    return try {
        val cropRow = field[index]
        val basketName = cropRow["basket"] as String
        "Harvest successful!"
    } catch (e: IndexOutOfBoundsException) {
        "Invalid index! The specified crop row does not exist."
    } catch (e: ClassCastException) {
        "Invalid crop row! The crop row does not have a 'basket' key"
    }
}