From 52d43529322de3896143b640415ea9ef8998712a Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 18 Mar 2014 13:08:01 +1100 Subject: Changed file extensions to ensure correct language detection on github --- map.pro | 107 ------------------------------------------------------------ map.prolog | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ read.pro | 56 ------------------------------- read.prolog | 56 +++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 163 deletions(-) delete mode 100644 map.pro create mode 100644 map.prolog delete mode 100644 read.pro create mode 100644 read.prolog diff --git a/map.pro b/map.pro deleted file mode 100644 index aee7a56..0000000 --- a/map.pro +++ /dev/null @@ -1,107 +0,0 @@ - - -% 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 - - -% 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). - diff --git a/map.prolog b/map.prolog new file mode 100644 index 0000000..aee7a56 --- /dev/null +++ b/map.prolog @@ -0,0 +1,107 @@ + + +% 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 + + +% 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). + diff --git a/read.pro b/read.pro deleted file mode 100644 index 63d3ae7..0000000 --- a/read.pro +++ /dev/null @@ -1,56 +0,0 @@ - -:- module(read, [prompt/1, readList/1]). - - -% functions for obtaining a line of input text and parsing -% it into a list of words - -% prompt provides the user with a '>' prompt as well -% readList merely obtains and parses the input - - -prompt(L) :- - write('> '), - readList(L). - - -readList(L) :- - readLine(X), - wordList(L,X,[]), !. - - -readLine(L) :- - get_char(C), - readLine_tail(C,L). - - -readLine_tail('\n',[]) :- !. -readLine_tail(C,[C|X]) :- - get_char(C2), - readLine_tail(C2,X). - - -wordList(X) --> whitespace, wordList(X). -wordList([X]) --> word(X). -wordList([X]) --> word(X), whitespace. -wordList([X|Y]) --> word(X), whitespace, wordList(Y). - - -word(W) --> charList(X), {atom_chars(W,X)}. - - -charList([X|Xs]) --> char(X), charList(Xs). -charList([X]) --> char(X). - - -whitespace --> whsp, whitespace. -whitespace --> whsp. - - -whsp --> oneOf(_,[' ', '\r', '\n', '\t']). -char(X) --> noneOf(X,[' ', '\r', '\n', '\t']). - - -oneOf(X,L) --> [X], {member(X,L)}. -noneOf(X,L) --> [X], {not(member(X,L))}. - diff --git a/read.prolog b/read.prolog new file mode 100644 index 0000000..63d3ae7 --- /dev/null +++ b/read.prolog @@ -0,0 +1,56 @@ + +:- module(read, [prompt/1, readList/1]). + + +% functions for obtaining a line of input text and parsing +% it into a list of words + +% prompt provides the user with a '>' prompt as well +% readList merely obtains and parses the input + + +prompt(L) :- + write('> '), + readList(L). + + +readList(L) :- + readLine(X), + wordList(L,X,[]), !. + + +readLine(L) :- + get_char(C), + readLine_tail(C,L). + + +readLine_tail('\n',[]) :- !. +readLine_tail(C,[C|X]) :- + get_char(C2), + readLine_tail(C2,X). + + +wordList(X) --> whitespace, wordList(X). +wordList([X]) --> word(X). +wordList([X]) --> word(X), whitespace. +wordList([X|Y]) --> word(X), whitespace, wordList(Y). + + +word(W) --> charList(X), {atom_chars(W,X)}. + + +charList([X|Xs]) --> char(X), charList(Xs). +charList([X]) --> char(X). + + +whitespace --> whsp, whitespace. +whitespace --> whsp. + + +whsp --> oneOf(_,[' ', '\r', '\n', '\t']). +char(X) --> noneOf(X,[' ', '\r', '\n', '\t']). + + +oneOf(X,L) --> [X], {member(X,L)}. +noneOf(X,L) --> [X], {not(member(X,L))}. + -- cgit