Boris, this is becoming better. It’s almost good. Thanks.
As you can see, some queries were not answered correctly by the program (I don’t know why). I’m content anyways.
I didn’t understand when and where should i type the three backticks.
pi@raspberrypi:~ $ swipl
Warning: Package bddem: no binary for architecture armhf
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 7.2.3)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
?- [office].
true.
?- supervises(black,green).
true .
?- supervises(gray,green).
false.
?- adminWorker(black).
true.
?- supervises(brown,white).
false.
?- supervises(brown, white).
false.
?- supervises(brown,black).
true .
?- trace.
true.
[trace] ?- notrace.
true.
[debug] ?-
?- trace.
true.
[trace] ?- supervises(who,green).
Call: (7) supervises(who, green) ? skip
Fail: (7) supervises(who, green) ? up
false.
[trace] ?- supervises(who, green).
Call: (7) supervises(who, green) ? creep
Call: (8) manager(who) ? creep
Fail: (8) manager(who) ? creep
Redo: (7) supervises(who, green) ? creep
Call: (8) adminWorker(who) ? creep
Fail: (8) adminWorker(who) ? creep
Redo: (7) supervises(who, green) ? creep
Call: (8) manager(who) ? creep
Fail: (8) manager(who) ? creep
Fail: (7) supervises(who, green) ? creep
false.
[trace] ?- notrace.
true.
[debug] ?-
|
|
NOW IT LOOKS MORE LIKE MY BOOK. This is very good.
?- trace.
true.
[trace] ?- supervises(_G2345, green).
Call: (7) supervises(_G932, green) ? creep
Call: (8) manager(_G932) ? creep
Exit: (8) manager(brown) ? creep
Call: (8) adminWorker(green) ? creep
Fail: (8) adminWorker(green) ? creep
Redo: (8) manager(_G932) ? creep
Exit: (8) manager(grey) ? creep
Call: (8) adminWorker(green) ? creep
Fail: (8) adminWorker(green) ? creep
Redo: (7) supervises(_G932, green) ? creep
Call: (8) adminWorker(_G932) ? creep
Exit: (8) adminWorker(black) ? creep
Call: (8) officeJunior(green) ? creep
Exit: (8) officeJunior(green) ? creep
Exit: (7) supervises(black, green) ? creep
_G2345 = black .
[trace] ?-
Boris,
this is working not completely like the book. After
the last query the expert system didn’t give the answer: “I guess that the animal es penguin”, But this is great advance, don’t you think? I just enter the into the train for a long trip to Siberia and i feel grateful and humble for your big help and the other professors,
For help, use ?- help(Topic). or ?- apropos(Word).
?- [animal].
true.
?- go.
Does the animal have the following attribute: has_hair? yes.
Does the animal have the following attribute: eats_meat? |: yes.
Does the animal have the following attribute: has_tawny_color? |: yes.
Does the animal have the following attribute: has_dark_spots? |: no.
Does the animal have the following attribute: has_black_stripes? |: yes.
I guess that the animal is: tiger
true.
?- go.
Does the animal have the following attribute: has_hair? no.
Does the animal have the following attribute: gives_milk? |: no.
Does the animal have the following attribute: has_feathers? |: yes.
Does the animal have the following attribute: does_not_fly? |: yes.
Does the animal have the following attribute: has_long_neck? |: no.
Does the animal have the following attribute: swims? |: yes
|:
|:
Except for this suggestion made by you, I am good now. I’ll continue doing the exercises of my book.
Thank you very much for your valuable help.