summaryrefslogtreecommitdiff
path: root/map.prolog
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-04-04 01:48:43 +1100
committerJed Barber <jjbarber@y7mail.com>2014-04-04 01:48:43 +1100
commit19e66dbd8fd3bd66f286bbbcd7ce842d727a4422 (patch)
tree07f0d484b32c9792a5d18921048243d5ed924873 /map.prolog
parentb2081e26122b3937f04caa62ec864fc343f83ef1 (diff)
Makefile added, files reorganised
Diffstat (limited to 'map.prolog')
-rw-r--r--map.prolog135
1 files changed, 0 insertions, 135 deletions
diff --git a/map.prolog b/map.prolog
deleted file mode 100644
index f5bb863..0000000
--- a/map.prolog
+++ /dev/null
@@ -1,135 +0,0 @@
-
-:- module(map, [roomList/1, isConnected/1, connects/3]).
-
-
-:- consult('misc.prolog').
-
-
-
-
-% map has 20 rooms, labelled a through t
-% connections between rooms inscribe a dodecahedron, with the rooms
-% corresponding to the vertices and the connections between them to
-% the edges
-
-
-roomList(X) :- X = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t].
-
-
-isConnected([]) :- true.
-isConnected(X) :-
- head(Y,X),
- tail(Z,X),
- connectTail([Y],Z).
-
-connectTail(_,[]) :- true.
-connectTail([],_) :- false.
-connectTail(Open,G) :-
- head(X,Open),
- tail(Y,Open),
- findall(N, connects(X,N,_), Ns),
- subtract(G,Ns,Gx),
- subtract(G,Gx,Nx),
- append(Y,Nx,Yx),
- connectTail(Yx,Gx).
-
-
-% loop around the middle
-
-connects(a,b,northeast).
-connects(b,c,southeast).
-connects(c,d,northeast).
-connects(d,e,southeast).
-connects(e,f,northeast).
-connects(f,g,southeast).
-connects(g,h,northeast).
-connects(h,i,southeast).
-connects(i,j,northeast).
-connects(j,a,southeast).
-
-
-% loop in the other direction around the middle
-
-connects(a,j,northwest).
-connects(j,i,southwest).
-connects(i,h,northwest).
-connects(h,g,southwest).
-connects(g,f,northwest).
-connects(f,e,southwest).
-connects(e,d,northwest).
-connects(d,c,southwest).
-connects(c,b,northwest).
-connects(b,a,southwest).
-
-
-% connections from the middle loop up to the top pentagon
-
-connects(b,k,north).
-connects(d,l,north).
-connects(f,m,north).
-connects(h,n,north).
-connects(j,o,north).
-
-
-% connections from the top pentagon down to the middle loop
-
-connects(k,b,south).
-connects(l,d,south).
-connects(m,f,south).
-connects(n,h,south).
-connects(o,j,south).
-
-
-% connections around the top pentagon
-
-connects(k,l,east).
-connects(l,m,east).
-connects(m,n,east).
-connects(n,o,east).
-connects(o,k,east).
-
-
-% connections around the top pentagon in the other direction
-
-connects(l,k,west).
-connects(m,l,west).
-connects(n,m,west).
-connects(o,n,west).
-connects(k,o,west).
-
-
-% connections from the middle loop to the bottom pentagon
-
-connects(a,p,south).
-connects(c,q,south).
-connects(e,r,south).
-connects(g,s,south).
-connects(i,t,south).
-
-
-% connections from the bottom pentagon up to the middle loop
-
-connects(p,a,north).
-connects(q,c,north).
-connects(r,e,north).
-connects(s,g,north).
-connects(t,i,north).
-
-
-% connections around the bottom pentagon
-
-connects(p,q,east).
-connects(q,r,east).
-connects(r,s,east).
-connects(s,t,east).
-connects(t,p,east).
-
-
-% connections around the bottom pentagon in the other direction
-
-connects(q,p,west).
-connects(r,q,west).
-connects(s,r,west).
-connects(t,s,west).
-connects(p,t,west).
-