home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / library / prolo_c / exampl09.pro < prev    next >
Text File  |  1986-10-06  |  668b  |  28 lines

  1. /* Program 9 */
  2. /*
  3.   Goals to enter are on page 40 of the manual.
  4. */
  5.  
  6. domains
  7.     row, column, step = integer
  8.     movement = up(step); down(step);
  9.                left(step); right(step); no
  10. predicates
  11.     move_cursor(row,column,movement)
  12.  
  13. clauses
  14.     move_cursor(R,C,up(Step)):-
  15.         cursor(R,C),
  16.         R1=R-Step,cursor(R1,C).
  17.     move_cursor(R,C,down(Step)):-
  18.         cursor(R,C),
  19.         R1=R+Step,cursor(R1,C).
  20.     move_cursor(R,C,left(Step)):-
  21.         cursor(R,C),
  22.         C1=C-Step,cursor(R,C1).
  23.     move_cursor(R,C,right(Step)):-
  24.         cursor(R,C),
  25.         C1=C+Step,cursor(R,C1).
  26.     move_cursor(R,C,no):-
  27.         cursor(R,C).
  28.