summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-31 16:30:34 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-31 16:30:34 +1100
commit0a87a1b949aa6de597dd31fa2ee414afa57627db (patch)
treed7476c9f9d5e073a06917db03e393a8d77478b67
parentaf78c32c6a2e181f2e7765cdda07af7ae6a187e2 (diff)
Added bats
-rw-r--r--agent.prolog15
1 files changed, 14 insertions, 1 deletions
diff --git a/agent.prolog b/agent.prolog
index d936d3f..0fa24a2 100644
--- a/agent.prolog
+++ b/agent.prolog
@@ -55,7 +55,20 @@ insertGold(N) :-
insertGold(0) :- true.
-initBats :- true.
+initBats :-
+ retractall(batsAt(_)),
+ insertBats(2).
+
+
+insertBats(N) :-
+ N > 0,
+ Nx is N - 1,
+ insertBats(Nx),
+ roomList(Rooms),
+ filter(Rooms, somethingAt, Emptyrooms),
+ random_member(X,Emptyrooms),
+ asserta(batsAt(X)).
+insertBats(0) :- true.