Right now Prolog is available under medusa, but not under the other clients, so one must first do an ssh to medusa Here is a sample prolog source file, stored using the filename hanoi.pl:
% move all discs onto the center pole % discs start piled in order at left hanoi(N) :- move(N, left, center, right). move(0, _, _, _) :- !. move(N, A, B, C) :- M is N-1, move(M, A, C, B), inform(N, A, B), move(M, C, B, A). inform(I, X, Y) :- write('move disc '), write(I), write(' from '), write(X), write(' to '), write(Y), nl.Here is a sample session showing of the use of this file (boldface is user input):
% ssh medusa password: (give password here) medusa% pl Welcome to SWI-Prolog (Version 3.2.9) Copyright (c) 1993-1999 University of Amsterdam. All rights reserved. For help, use ?- help(Topic). or ?- apropos(Word). ?- consult(hanoi). hanoi compiled, 0.00 sec, 1,676 bytes. Yes ?- hanoi(1). move disc 1 from left to center Yes ?- hanoi(2). move disc 1 from left to right move disc 2 from left to center move disc 1 from right to center Yes ?- hanoi(3). move disc 1 from left to center move disc 2 from left to right move disc 1 from center to right move disc 3 from left to center move disc 1 from right to left move disc 2 from right to center move disc 1 from left to center Yes ?- halt. medusa%Prolog Resources:
spr03u(cs2213, '001', 1900-mw, maltrud). spr03u(cs2213, '002', 0930-tr, maltrud). spr03u(cs2413, '001', 1000-mwf, maynard). spr03u(cs2513, '001', 1200-mwf, key). spr03u(cs2733, '001', 1300-mwf, wagner). spr03u(cs3233, '001', 1230-tr, tian). spr03u(cs3343, '001', 1530-tr, kwek). spr03u(cs3723, '001', 1200-mwf, wagner). spr03u(cs3733, '001', 1230-tr, srobbins). spr03u(cs3743, '001', 1900-tr, staff). spr03u(cs3773, '001', 1730-tr, lo). spr03u(cs4313, '001', 1400-mw, bylander). spr03u(cs4363, '001', 1000-mwf, wagner). spr03u(cs4383, '001', 1300-mwf, maynard). spr03u(cs4753, '001', 1730-mw, yum). spr03u(cs4913, '000', arranged, staff). spr03u(cs4953, '001', 0930-tr, srobbins). spr03u(cs4993, '000', arranged, staff). semesteru(X, Y, Z, W) :- spr03u(X, Y, Z, W). year('2003'). season('Spring').These facts need to be combined with many other facts and rules to produce a reasonable listing. Some of the facts are names of courses, full names of instructors, better representation for times, and others. These additional facts and rules do not change (much) from semester to semester, so they are more-or-less universal.