home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Borland Plateform / Turbo Prolog 2 / EXAMPL42.PRO < prev    next >
Encoding:
Prolog Source  |  1986-04-01  |  475 b   |  17 lines

  1.                 /* Program 42 */
  2. domains
  3.     direction=up;down
  4. predicates
  5.       jack_and_jill(direction,integer)
  6. goal
  7.       jack_and_jill(up,500).
  8. clauses
  9.       jack_and_jill(up,F):-
  10.           F<5000,!,sound(1,F),F1=F+200,jack_and_jill(up,F1).
  11.       jack_and_jill(up,F):-
  12.           jack_and_jill(down,F).
  13.       jack_and_jill(down,F):-
  14.           F>500,!,sound(1,F),F1=F-200,jack_and_jill(down,F1).
  15.       jack_and_jill(down,F):-
  16.           jack_and_jill(up,F).
  17.