/**
 * Given a budget, the size of a room, and a list of materials with their respective prices and ratings,
 * choose the best material to use for the interior design of the room.
 *
 * @param budget The available budget for the interior design project.
 * @param roomSize The size of the room in square meters.
 * @param materials A list of maps, each containing the material's name, price per square meter, and rating.
 * @return The name of the best material to use.
 */
fun chooseBestMaterial(budget: Double, roomSize: Double, materials: List<Map<String, Any>>): String {

    // Filter out materials that exceed the budget and do not have a high rating
    val filteredMaterials = materials.filter {
        it["price"] as Double * roomSize < budget && it["rating"] as Int >= 8
    }

    // Sort the filtered materials by price per square meter in ascending order
    val sortedMaterials = filteredMaterials.sortedBy { it["price"] as Double }

    // Return the name of the material with the lowest price per square meter
    return sortedMaterials[0]["name"] as String
}
/**
 * Given a budget, the size of a room, and a list of materials with their respective prices and ratings,
 * choose the best material to use for the interior design of the room.
 *
 * @param budget The available budget for the interior design project.
 * @param roomSize The size of the room in square meters.
 * @param materials A list of maps, each containing the material's name, price per square meter, and rating.
 * @return The name of the best material to use.
 */
fun chooseBestMaterial(budget: Double, roomSize: Double, materials: List<Map<String, Any>>): String {
/**
 * Given a budget, the size of a room, and a list of materials with their respective prices and ratings,
 * choose the best material to use for the interior design of the room.
 *
 * @param budget The available budget for the interior design project.
 * @param roomSize The size of the room in square meters.
 * @param materials A list of maps, each containing the material's name, price per square meter, and rating.
 * @return The name of the best material to use.
 */
fun chooseBestMaterial(budget: Double, roomSize: Double, materials: List<Map<String, Any>>): String {

    // Filter out materials that exceed the budget and do not have a high rating
    val filteredMaterials = materials.filter {
        it["price"] as Double * roomSize < budget && it["rating"] as Int >= 8
    }

    // Sort the filtered materials by price per square meter in ascending order
    val sortedMaterials = filteredMaterials.sortedBy { it["price"] as Double }

    // Return the name of the material with the lowest price per square meter
    return sortedMaterials[0]["name"] as String
}