Then you will need to convert the code to Prolog. Despite their names, TurboProlog/VisualProlog, although interesting logic programming languages, are not Prolog systems as per official and de facto standard definitions of Prolog.
Up vote 0 down vote favorite share g+ share fb share tw.
Global facts xpositive(symbol,symbol) xnegative(symbol,symbol) predicates animal_is(symbol) - nondeterm (o) it_is(symbol) - nondeterm (i) ask(symbol,symbol,symbol) - determ (i,i,i) remember(symbol,symbol,symbol) - determ (i,i,i) positive(symbol,symbol) - determ (i,i) negative(symbol,symbol) - determ (i,i) clear_facts - determ () run - determ () clauses animal_is(cheetah):- it_is(mammal), it_is(carnivore), positive(has,tawny_color), positive(has,dark_spots). Animal_is(tiger):- it_is(mammal), it_is(carnivore), positive(has, tawny_color), positive(has, black_stripes). Animal_is(giraffe):- it_is(ungulate), positive(has,long_neck), positive(has,long_legs), positive(has, dark_spots).
Animal_is(zebra):- it_is(ungulate), positive(has,black_stripes). Animal_is(ostrich):- it_is(bird), negative(does,fly), positive(has,long_neck), positive(has,long_legs), positive(has, black_and_white_color). Animal_is(penguin):- it_is(bird), negative(does,fly), positive(does,swim), positive(has,black_and_white_color).
Animal_is(albatross):- it_is(bird),positive(does,fly_well). It_is(mammal):- positive(has,hair). It_is(mammal):- positive(does,give_milk).
It_is(bird):- positive(has,feathers). It_is(bird):- positive(does,fly), positive(does,lay_eggs). It_is(carnivore):- positive(does,eat_meat).
It_is(carnivore):- positive(has,pointed_teeth), positive(has, claws), positive(has,forward_eyes). It_is(ungulate):- it_is(mammal), positive(has,hooves). It_is(ungulate):- it_is(mammal), positive(does,chew_cud).
Positive(X,Y):- xpositive(X,Y),!. Positive(X,Y):- not(xnegative(X,Y)), ask(X,Y,yes). Negative(X,Y):- xnegative(X,Y),!.
Negative(X,Y):- not(xpositive(X,Y)), ask(X,Y,no). Ask(X,Y,yes):-! , write(X," it ",Y,'\n'), readln(Reply),nl, frontchar(Reply,'y',_), remember(X,Y,yes).
Ask(X,Y,no):-! , write(X," it ",Y,'\n'), readln(Reply),nl, frontchar(Reply,'n',_), remember(X,Y,no). Remember(X,Y,yes):- assertz(xpositive(X,Y)).
Remember(X,Y,no):- assertz(xnegative(X,Y)). Clear_facts:- write("\n\nPlease press the space bar to exit\n"), retractall(_,dbasedom), readchar(_). Run:- animal_is(X),!
, write("\nYour animal may be a (an) ",X), nl, clear_facts. Run:- write("\nUnable to determine what"), write("your animal is. \n\n"), clear_facts.
Goal run. I'm trying to run this expert system program but when I compile I get the following error. Compiling C:/Users/daemon/Desktop/ch16E01.
PRO for byte code... C:/Users/daemon/Desktop/ch16E01. PRO:1:8: syntax error: . Or operator expected after expression C:/Users/daemon/Desktop/ch16E01.
PRO:127:3: syntax error: . Or operator expected after expression 2 error(s) compilation failed prolog link|improve this question edited Mar 6 at 1:21svick28.4k62060 asked Mar 5 at 22:23daemon5484.
Then you will need to convert the code to Prolog. Despite their names, TurboProlog/VisualProlog, although interesting logic programming languages, are not Prolog systems as per official and de facto standard definitions of Prolog. Some of the changes to the code required for compiling it with a standard Prolog system (such as GNU Prolog) would include: removing the lines with the "clauses", and "goal" text"; also removing the "global facts" and "predicates" block; replacing double quotes in the arguments of write/1 by single quotes; replacing the call to readchar/1 with a call to get_char/1.
But there are other not so trivial changes. In the end, better to look for tutorial code written for Prolog in the first place.
The code you posted seems to have been written for TurboProlog/VisualProlog. But, looking at the compilation errors messages, it seems that you're using a(nother) Prolog compiler. Can you confirm?
Oh yes. I was actually trying to use GNU compiler. – daemon54 Mar 6 at 6:25.
Please paste the readable code in your compiler and post your errors.. DATABASE - dbasedom xpositive(symbol,symbol) xnegative(symbol,symbol) PREDICATES animal_is(symbol) - nondeterm (o) it_is(symbol) - nondeterm (i) ask(symbol,symbol,symbol) - determ (i,i,i) remember(symbol,symbol,symbol) - determ (i,i,i) positive(symbol,symbol) - determ (i,i) negative(symbol,symbol) - determ (i,i) clear_facts - determ () run - determ () Goal run. CLAUSES run:- animal_is(X),! , write("\nYour animal may be a (an) ",X), nl, clear_facts.
Run:- write("\nUnable to determine what"), write("your animal is. \n\n"), clear_facts. Animal_is(cheetah):- it_is(mammal), it_is(carnivore), positive(has,tawny_color), positive(has,dark_spots).
Animal_is(tiger):- it_is(mammal), it_is(carnivore), positive(has, tawny_color), positive(has, black_stripes). Animal_is(giraffe):- it_is(ungulate), positive(has,long_neck), positive(has,long_legs), positive(has, dark_spots). Animal_is(zebra):- it_is(ungulate), positive(has,black_stripes).
Animal_is(ostrich):- it_is(bird), negative(does,fly), positive(has,long_neck), positive(has,long_legs), positive(has, black_and_white_color). Animal_is(penguin):- it_is(bird), it_is(mammal):- positive(has,hair). It_is(mammal):- positive(does,give_milk).
It_is(bird):- positive(has,feathers). It_is(bird):- positive(does,fly), positive(does,lay_eggs). It_is(carnivore):- positive(does,eat_meat).
It_is(carnivore):- positive(has,pointed_teeth), positive(has, claws), positive(has,forward_eyes). It_is(ungulate):- it_is(mammal), positive(has,hooves). It_is(ungulate):- it_is(mammal), positive(does,chew_cud).
Positive(X,Y):- xpositive(X,Y),!. Positive(X,Y):- not(xnegative(X,Y)), ask(X,Y,yes). Negative(X,Y):- xnegative(X,Y),!.
Negative(X,Y):- not(xpositive(X,Y)), ask(X,Y,no). Ask(X,Y,yes):-! , write(X," it ",Y,'\n'), readln(Reply),nl, frontchar(Reply,'y',_), remember(X,Y,yes).
Ask(X,Y,no):-! , write(X," it ",Y,'\n'), readln(Reply),nl, frontchar(Reply,'n',_), remember(X,Y,no). Remember(X,Y,yes):- assertz(xpositive(X,Y)).
Remember(X,Y,no):- assertz(xnegative(X,Y)). Negative(does,fly), positive(does,swim), positive(has,black_and_white_color). Clear_facts:- write("\n\nPlease press the space bar to exit\n"), retractall(_,dbasedom), readchar(_).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.