home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_30.arc / EXPERT2.PRO < prev   
Text File  |  1979-12-31  |  896b  |  41 lines

  1.  
  2. challenger(Name, Country) :-
  3.     write('Who is the challenger?'),
  4.     nl,
  5.     read(Name),
  6.     asserta(challenger(Name, Country)).
  7.  
  8.  
  9. incumbent(Name, Country) :-
  10.     write('Who is the incumbent?'),
  11.     nl,
  12.     read(Name),
  13.     asserta(incumbent(Name, Country)).
  14.  
  15. elections(Country) :-
  16.     economy(Country, Condition),
  17.     Condition = booming,
  18.     incumbent(Person, Country),
  19.     write('0.6 chance of win for '),
  20.     nl,
  21.     write(Person),
  22.     nl,
  23.     !.
  24. elections(Country) :-
  25.     challenger(Person, Country),
  26.     write('challenger  '),
  27.     write(Person),
  28.     nl,
  29.     write('likely to win'),
  30.     nl,
  31.     !.
  32.  
  33. economy(Country, Condition) :-
  34.     write('Is current state of economy boooming?(y or n)'),
  35.     nl,
  36.     read(y),
  37.     asserta( (economy(Country, booming) :- !) ).
  38. economy(Country, Condition) :-
  39.     asserta( (economy(Country, shaky) :- ! ) ),
  40.     fail.
  41.