home *** CD-ROM | disk | FTP | other *** search
-
- challenger(Name, Country) :-
- write('Who is the challenger?'),
- nl,
- read(Name),
- asserta(challenger(Name, Country)).
-
-
- incumbent(Name, Country) :-
- write('Who is the incumbent?'),
- nl,
- read(Name),
- asserta(incumbent(Name, Country)).
-
- elections(Country) :-
- economy(Country, Condition),
- Condition = booming,
- incumbent(Person, Country),
- write('0.6 chance of win for '),
- nl,
- write(Person),
- nl,
- !.
- elections(Country) :-
- challenger(Person, Country),
- write('challenger '),
- write(Person),
- nl,
- write('likely to win'),
- nl,
- !.
-
- economy(Country, Condition) :-
- write('Is current state of economy boooming?(y or n)'),
- nl,
- read(y),
- asserta( (economy(Country, booming) :- !) ).
- economy(Country, Condition) :-
- asserta( (economy(Country, shaky) :- ! ) ),
- fail.