In this extended activity, you will further work with facts and rules, aiming for a profound comprehension
Question:
In this extended activity, you will further work with facts and rules, aiming for a profound comprehension of the subject matter. The primary focus of this activity is to introduce the utilization of a dynamic database, a crucial step in advancing your programming skills. The dynamic database not only contributes to an enhanced user experience but also plays a pivotal role in optimizing program efficiency.
To guide you through this task, please refer to the attached video demonstrating how to use and apply a dynamic database. Your assignment is to expand your existing family program by integrating a dynamic database into it.
Deliverables:
- 1. Your updated code which incorporates a dynamic database that is designed to handle both affirmative and non-affirmative user responses effectively. The database responds intelligently based on user input, providing a seamless experience regardless of the user's response type.
- 2. Screenshots from several runs of your program showcasing its functionality and interaction with the dynamic database.
This activity is designed to support your successful completion of Assignment 2, Question 1.
P.S.:
If you face any issues with running the code, please change
read_string/5 with read (Response)
and use single quotes with strings instead of double quotes.
animal(dog) :- is_true('has fur'), is_true('says woof').
animal(cat) :- is_true('has fur'), is_true('says meow').
animal(duck) :- is_true('has feathers'), is_true('says quack').
is_true(X) :- remember(X, 'yes'), !.
is_true(X) :- ask(X).
:- dynamic remember/2.
ask(Question) :-
write('Does the animal have the following attribute: '),
write(Question), write('? '),
read(Response),
Response == 'yes',
assertz(remember(Question, Response)).
go :-
retractall(remember(_, _)),
animal(Animal),
write('I guess that the animal is: '), write(Animal), !.
go :-
write('I cannot recognize your animal').
Auditing and Assurance Services A Systematic Approach
ISBN: 978-1259162343
9th edition
Authors: William Messier, Steven Glover, Douglas Prawitt