home *** CD-ROM | disk | FTP | other *** search
Prolog Source | 1986-10-07 | 668 b | 28 lines |
- /* Program 9 */
- /*
- Goals to enter are on page 40 of the manual.
- */
-
- domains
- row, column, step = integer
- movement = up(step); down(step);
- left(step); right(step); no
- predicates
- move_cursor(row,column,movement)
-
- clauses
- move_cursor(R,C,up(Step)):-
- cursor(R,C),
- R1=R-Step,cursor(R1,C).
- move_cursor(R,C,down(Step)):-
- cursor(R,C),
- R1=R+Step,cursor(R1,C).
- move_cursor(R,C,left(Step)):-
- cursor(R,C),
- C1=C-Step,cursor(R,C1).
- move_cursor(R,C,right(Step)):-
- cursor(R,C),
- C1=C+Step,cursor(R,C1).
- move_cursor(R,C,no):-
- cursor(R,C).
-