Question: prolog programming PROLOG PROGRAMMING planner :- ask_user, forward. % 'ask_user' is defined in Step 1 below. % 'forward' starts Bratko's forward chaining % rule interpreter
prolog programming
PROLOG PROGRAMMING
planner :- ask_user, forward.
% 'ask_user' is defined in Step 1 below.
% 'forward' starts Bratko's forward chaining
% rule interpreter on your rules in step 2
.% Step 1 (2 points):% Implement the Prolog predicate ask_user HERE
.% ask_user asks questions, reads in the answers, and
% asserts the user's answers as facts.
% Type your solution to step 1 here
:% Step 2 (3 points): Put your forward chaining rules here.
% Warning: 'and', 'or', and 'not' can only be used in the
% 'if' part (condition) of the expert system rule. If
% you put them in the 'then' part, you probably will
% not get an error/warning, but your rules won't work
% correctly!
% Type your solution to step 2 here:
& Problem: Implement a system that plans breakfast, % lunch, and dinner for one day, based upon the user's % preferences. The system first asks the user about his for her preferences by at least 3 questions. Then it & runs an expert system to derive the menu for breakfast, % lunch, and dinner IN THAT ORDER. You can ask any questions % that you wish. The system should plan different % menus depending on the answers, though it is okay to have & the same menu for some answers. Screen shots should show the output of your program for EVERY REASONABLE INPUT. % Here are some sample interactions. (Note that the FC rule interpreter wrote "Derived ..." and "No more facts" and % Prolog wrote 'true'.) % % ? - planner. $ Are you a vegetarian? (y or n): n. % Do you eat beef? (y or n): y. % Do you like fish? (y or n): y. .. etc. % Derived: plan_breakfast % Derived: eat egg_biscuit_for_breakfast % Derived: plan_lunch & Derived: eat_beef_burger_for_lunch % Derived: plan_dinner $ Derived: eat_fish_for_dinner % No more facts % true & Problem: Implement a system that plans breakfast, % lunch, and dinner for one day, based upon the user's % preferences. The system first asks the user about his for her preferences by at least 3 questions. Then it & runs an expert system to derive the menu for breakfast, % lunch, and dinner IN THAT ORDER. You can ask any questions % that you wish. The system should plan different % menus depending on the answers, though it is okay to have & the same menu for some answers. Screen shots should show the output of your program for EVERY REASONABLE INPUT. % Here are some sample interactions. (Note that the FC rule interpreter wrote "Derived ..." and "No more facts" and % Prolog wrote 'true'.) % % ? - planner. $ Are you a vegetarian? (y or n): n. % Do you eat beef? (y or n): y. % Do you like fish? (y or n): y. .. etc. % Derived: plan_breakfast % Derived: eat egg_biscuit_for_breakfast % Derived: plan_lunch & Derived: eat_beef_burger_for_lunch % Derived: plan_dinner $ Derived: eat_fish_for_dinner % No more facts % true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
