diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-04-05 04:44:44 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-04-05 04:44:44 +1100 |
commit | 95eb0d9ab85395efdeb22dfff0b3b0c1b9c0d177 (patch) | |
tree | d97a86315c6e047e4c345ea49eaba4ac02588585 /src | |
parent | 19e66dbd8fd3bd66f286bbbcd7ce842d727a4422 (diff) |
Tweaks to text output and startup
Diffstat (limited to 'src')
-rw-r--r-- | src/agent.prolog | 22 | ||||
-rw-r--r-- | src/main.prolog | 1 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/agent.prolog b/src/agent.prolog index 4085bf9..0b8ed3e 100644 --- a/src/agent.prolog +++ b/src/agent.prolog @@ -12,6 +12,11 @@ % initialisation init :- + retractall(here(_)), + retractall(pitAt(_)), + retractall(wumpusAt(_)), + retractall(goldAt(_)), + retractall(batsAt(_)), initPos, initPits, initWumpus, @@ -25,20 +30,16 @@ init :- initPos :- retractall(moves(_)), asserta(moves(0)), - retractall(here(_)), roomList(Rooms), filter(Rooms, somethingAt, Emptyrooms), random_member(X,Emptyrooms), asserta(here(X)). -initPits :- - retractall(pitAt(_)), - insert(5,pitAt). +initPits :- insert(4,pitAt). initWumpus :- - retractall(wumpusAt(_)), roomList(Rooms), filter(Rooms, somethingAt, Emptyrooms), random_member(X,Emptyrooms), @@ -46,15 +47,12 @@ initWumpus :- initGold :- - retractall(goldAt(_)), retractall(haveGold(_)), insert(3,goldAt), asserta(haveGold(0)). -initBats :- - retractall(batsAt(_)), - insert(2,batsAt). +initBats :- insert(2,batsAt). insert(N,Thing) :- @@ -179,7 +177,7 @@ stench(_) :- true. writeExits(Location) :- findall(X, connects(Location,_,X), Exits), intercalate(Exits, ', ', O), - join(['There are exits to the ',O,'.\n'],W), + join(['There are exits to the ',O,'.\n\n'],W), write(W). @@ -252,13 +250,13 @@ win :- lose(eaten) :- - write('You have been eaten by the wumpus.\n'), + write('You have been eaten by the wumpus.\n\n'), write('*** GAME OVER ***\n'), halt(0). lose(pit) :- - write('You have fallen into a bottomless pit.\n'), + write('You have fallen into a bottomless pit.\n\n'), write('*** GAME OVER ***\n'), halt(0). diff --git a/src/main.prolog b/src/main.prolog index ef23f4f..09011ed 100644 --- a/src/main.prolog +++ b/src/main.prolog @@ -8,6 +8,7 @@ play :- + write('\n\nHUNT THE WUMPUS\n\n\n'), init, look, playLoop. |