Question: I would like to write a prolog program that decides which pair of shoes I should wear today based on the weather and what type

I would like to write a prolog program that decides which pair of shoes I should wear today based on the weather and what type of appointment I have at the office. What I have so far is the rules for the types of shoes I have:

I would like to write a prolog program that decides which pair

Now that the rules are defined for when to wear each type of shoe, I need a way to print the result. As an example, when this rule is called:

write("F1: "), outfit(snow, 15, casual, F1), write(F1).

Where "snow" is the weather, "15" is the temperature(not relevant here), and "casual" is the formality of the appointment. It must output "[dressshoes]," "[boots]," or "[sneakers]." So the variable "F1" must contain either one of these values and printed to the console. I need help continuing the code I already have to print the output from the variable F1.

= Rules for weather rain (Weather) :- (Weather 'rain'). snow (Weather) :- (Weather = 'snow'). nice (Weather) :- (Weather = 'nice'). clear (Weather) :- (Weather = 'clear'). Rules for formality formal (Appointment) :- (Appointment = 'formal'). semi formal (Appointment) :- (Appointment = 'semiformal'). casual (Appointment) :- (Appointment = 'casual'). SRules for when to wear a type of footwear dressShoes (Appointment) :- formal (Appointment). boots (Appointment, Weather) :- not (formal (Appointment)), (rain (Weather); snow (Weather)). sneakers (Appointment, Weather) :- not (formal (Appointment)), (nice (Weather);clear (Weather)). = Rules for weather rain (Weather) :- (Weather 'rain'). snow (Weather) :- (Weather = 'snow'). nice (Weather) :- (Weather = 'nice'). clear (Weather) :- (Weather = 'clear'). Rules for formality formal (Appointment) :- (Appointment = 'formal'). semi formal (Appointment) :- (Appointment = 'semiformal'). casual (Appointment) :- (Appointment = 'casual'). SRules for when to wear a type of footwear dressShoes (Appointment) :- formal (Appointment). boots (Appointment, Weather) :- not (formal (Appointment)), (rain (Weather); snow (Weather)). sneakers (Appointment, Weather) :- not (formal (Appointment)), (nice (Weather);clear (Weather))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!