summaryrefslogtreecommitdiff
path: root/agent.prolog
diff options
context:
space:
mode:
Diffstat (limited to 'agent.prolog')
-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.