[FrontPage] [TitleIndex] [WordIndex

Prolog Code

{{{% Hunt the Wumpus % A Logic Puzzle-Inspired Textgame % Katie Rivard, 6/28/04 % Map: %%%%%%%%%%%%% %a %b %c %dW% %%%%%%%%%%%%% %e %f@%g %h$% %%%%%%%%%%%%% %i %j %k %l % %%%%%%%%%%%%% %m %n %o %p % %%%%%%%%%%%%%

%% Figure out a way to make this less horrid: northof(a,e). northof(b,f). northof(c,g). northof(d,h). northof(e,i). northof(f,j). northof(g,k). northof(h,l). northof(i,m). northof(j,n). northof(k,o). northof(l,p).

westof(a,b). westof(b,c). westof(c,d). westof(e,f). westof(f,g). westof(g,h). westof(i,j). westof(j,k). westof(k,l). westof(m,n). westof(n,o). westof(o,p).

southof(A,B):-

eastof(A,B):-

adj(A,B):-

:- dynamic(gold/1). :- dynamic(you/1).

pit(f). wumpus(d). gold(h). you(i).

goto(X):-

look:-

climb:-

climb:-

quit:- !, fail.

help:-

%% This one's more learning-ful, but less useful to the game. %tell_adj(X,T):- % adj(X,Y), % \+(member(Y,T)), % write(Y),write(' is adjacent.'),nl, % tell_adj(X, [Y|T]).

tell_north(X):-

tell_north(_).

tell_south(X):-

tell_south(_).

tell_east(X):-

tell_east(_).

tell_west(X):-

tell_west(_).

breezy(X):-

tell_breezy(X):-

tell_breezy(_).

smelly(X):-

tell_smelly(X):-

tell_smelly(_).

goldcheck:-

goldcheck.

death:-

done:-

go:- done,

go:-


2013-07-17 10:43