3f23f6b95cac

Fix parsing to not be recursive
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Mar 2017 16:35:43 +0000
parents 49fd0e0e0c80
children 77a187682a5d
branches/tags (none)
files gdl/kriegTTT_5x5.gdl gdl/latenttictactoe.gdl gdl/mastermind.gdl gdl/small_dominion.gdl gdl/stratego.gdl gdl/transit.gdl gdl/vis_pacman3p.gdl src/grounders/fluxplayer.lisp src/players/random-zdd.lisp src/reasoners/zdd.lisp src/rule-trees.lisp

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/kriegTTT_5x5.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,171 @@
+(role xplayer)
+(role oplayer)
+
+(init (cell 1 1 b))
+(init (cell 1 2 b))
+(init (cell 1 3 b))
+(init (cell 1 4 b))
+(init (cell 1 5 b))
+(init (cell 2 1 b))
+(init (cell 2 2 b))
+(init (cell 2 3 b))
+(init (cell 2 4 b))
+(init (cell 2 5 b))
+(init (cell 3 1 b))
+(init (cell 3 2 b))
+(init (cell 3 3 b))
+(init (cell 3 4 b))
+(init (cell 3 5 b))
+(init (cell 4 1 b))
+(init (cell 4 2 b))
+(init (cell 4 3 b))
+(init (cell 4 4 b))
+(init (cell 4 5 b))
+(init (cell 5 1 b))
+(init (cell 5 2 b))
+(init (cell 5 3 b))
+(init (cell 5 4 b))
+(init (cell 5 5 b))
+(init (step 1))
+
+(<= (legal ?p (mark ?m ?n))
+   (role ?p)
+   (true (cell ?m ?n ?c))
+   (distinct ?c ?p)
+   (not (true (tried ?p ?m ?n))))
+
+(<= doublehit
+   (does xplayer (mark ?m ?n))
+   (does oplayer (mark ?m ?n)))
+
+(<= (validmove ?p ?m ?n)
+   (does ?p (mark ?m ?n))
+   (true (cell ?m ?n b))
+   (not doublehit))
+
+(<= (marked ?m ?n)
+   (does ?p (mark ?m ?n))
+   (not doublehit))
+
+(<= (next (cell ?m ?n ?p))
+   (validmove ?p ?m ?n))
+
+(<= (next (cell ?m ?n ?c))
+   (true (cell ?m ?n ?c))
+   (distinct ?c b))
+
+(<= (next (cell ?m ?n b))
+   (true (cell ?m ?n b))
+   (not (marked ?m ?n)))
+
+(<= (next (tried ?p ?m ?n))
+   (does ?p (mark ?m ?n))
+   (not (validmove ?p ?m ?n)))
+
+(<= (next (tried ?p ?m1 ?n1))
+   (true (tried ?p ?m1 ?n1))
+   (does ?p (mark ?m2 ?n2))
+   (not (validmove ?p ?m2 ?n2)))
+
+(<= (next (step ?n))
+   (true (step ?m))
+   (succ ?m ?n))
+
+(<= (sees ?p (yougotit ?m ?n))
+   (validmove ?p ?m ?n))
+
+(<= (sees ?p (mark ?m ?n))
+   (does ?p (mark ?m ?n))
+   (not (validmove ?p ?m ?n)))
+
+(<= terminal
+   (line xplayer))
+
+(<= terminal
+   (line oplayer))
+
+(<= terminal
+   (not open))
+
+(<= terminal
+   (true (step 30)))
+
+(<= (line ?c)
+   (true (cell ?m 1 ?c))
+   (true (cell ?m 2 ?c))
+   (true (cell ?m 3 ?c))
+   (true (cell ?m 4 ?c)))
+
+(<= (line ?c)
+   (true (cell ?m 2 ?c))
+   (true (cell ?m 3 ?c))
+   (true (cell ?m 4 ?c))
+   (true (cell ?m 5 ?c)))
+
+(<= (line ?c)
+   (true (cell 1 ?n ?c))
+   (true (cell 2 ?n ?c))
+   (true (cell 3 ?n ?c))
+   (true (cell 4 ?n ?c)))
+
+(<= (line ?c)
+   (true (cell 2 ?n ?c))
+   (true (cell 3 ?n ?c))
+   (true (cell 4 ?n ?c))
+   (true (cell 5 ?n ?c)))
+
+(<= open
+   (true (cell ?m1 ?n1 b))
+   (not (true (tried xplayer ?m1 ?n1)))
+   (true (cell ?m2 ?n2 b))
+   (not (true (tried oplayer ?m2 ?n2))))
+
+(<= (goal xplayer 100)
+   (line xplayer))
+  
+(<= (goal xplayer 50)
+   (not (line xplayer))
+   (not (line oplayer)))
+  
+(<= (goal xplayer 0)
+   (line oplayer))
+
+(<= (goal oplayer 100)
+   (line oplayer))
+  
+(<= (goal oplayer 50)
+   (not (line xplayer))
+   (not (line oplayer)))
+  
+(<= (goal oplayer 0)
+   (line xplayer))
+
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+(succ 8 9)
+(succ 9 10)
+(succ 10 11)
+(succ 11 12)
+(succ 12 13)
+(succ 13 14)
+(succ 14 15)
+(succ 15 16)
+(succ 16 17)
+(succ 17 18)
+(succ 18 19)
+(succ 19 20)
+(succ 20 21)
+(succ 21 22)
+(succ 22 23)
+(succ 23 24)
+(succ 24 25)
+(succ 25 26)
+(succ 26 27)
+(succ 27 28)
+(succ 28 29)
+(succ 29 30)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/latenttictactoe.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,262 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Latent Tictactoe
+;;; Based on Tictactoe game available at GGP-Server
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Created by: Tomas Motal (tmotal@labe.felk.cvut.cz)
+;;; Czech Technical University in Prague
+;;; Faculty of Elektrotechnics, department of Cybernetics.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Rules: The same rules as for standard tic tac toe apply only players do not 
+;; see opponent's moves unless they try to put their mark on a location where
+;; there already is opponent's mark from the previous turns.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Roles
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (role xplayer)
+  (role oplayer)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Initial State
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (init (cell 1 1 b))
+  (init (cell 1 2 b))
+  (init (cell 1 3 b))
+  (init (cell 2 1 b))
+  (init (cell 2 2 b))
+  (init (cell 2 3 b))
+  (init (cell 3 1 b))
+  (init (cell 3 2 b))
+  (init (cell 3 3 b))
+  (init (deniedx 1 1 b))
+  (init (deniedx 1 2 b))
+  (init (deniedx 1 3 b))
+  (init (deniedx 2 1 b))
+  (init (deniedx 2 2 b))
+  (init (deniedx 2 3 b))
+  (init (deniedx 3 1 b))
+  (init (deniedx 3 2 b))
+  (init (deniedx 3 3 b))
+  (init (deniedo 1 1 b))
+  (init (deniedo 1 2 b))
+  (init (deniedo 1 3 b))
+  (init (deniedo 2 1 b))
+  (init (deniedo 2 2 b))
+  (init (deniedo 2 3 b))
+  (init (deniedo 3 1 b))
+  (init (deniedo 3 2 b))
+  (init (deniedo 3 3 b))
+  (init (control xplayer))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Dynamic Components
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (<= (next (cell ?m ?n x))
+      (does xplayer (mark ?m ?n))
+      (true (cell ?m ?n b)))
+
+  (<= (next (deniedx ?m ?n x))
+      (does xplayer (mark ?m ?n))
+      (true (deniedx ?m ?n b)))
+
+  (<= (next (cell ?m ?n o))
+      (does oplayer (mark ?m ?n))
+      (true (cell ?m ?n b)))
+
+  (<= (next (deniedo ?m ?n x))
+      (does oplayer (mark ?m ?n))
+      (true (deniedo ?m ?n b)))
+
+  (<= (next (cell ?m ?n ?w))
+      (true (cell ?m ?n ?w))
+      (distinct ?w b))
+
+  (<= (next (cell ?m ?n b))
+      (does ?w (mark ?j ?k))
+      (true (cell ?m ?n b))
+      (or (distinct ?m ?j) (distinct ?n ?k)))
+
+  (<= (next (deniedx ?m ?n x))
+      (true (deniedx ?m ?n x)))
+
+  (<= (next (deniedo ?m ?n x))
+      (true (deniedo ?m ?n x)))
+
+  (<= (next (deniedx ?m ?n b))
+      (does xplayer (mark ?j ?k))
+      (true (deniedx ?m ?n b))
+      (or (distinct ?m ?j) (distinct ?n ?k)))
+
+  (<= (next (deniedo ?m ?n b))
+      (does oplayer (mark ?j ?k))
+      (true (deniedo ?m ?n b))
+      (or (distinct ?m ?j) (distinct ?n ?k)))
+
+  (<= (next (deniedo ?m ?n b))
+      (does xplayer (mark ?m ?n))
+      (true (deniedo ?m ?n b)))
+
+  (<= (next (deniedx ?m ?n b))
+      (does oplayer (mark ?m ?n))
+      (true (deniedx ?m ?n b)))
+
+  (<= (next (deniedo ?m ?n b))
+      (does xplayer (mark ?j ?k))
+      (true (deniedo ?m ?n b))
+      (or (distinct ?m ?j) (distinct ?n ?k)))
+
+  (<= (next (deniedx ?m ?n b))
+      (does oplayer (mark ?j ?k))
+      (true (deniedx ?m ?n b))
+      (or (distinct ?m ?j) (distinct ?n ?k)))
+
+  (<= (row ?m ?x)
+      (true (cell ?m 1 ?x))
+      (true (cell ?m 2 ?x))
+      (true (cell ?m 3 ?x)))
+
+  (<= (column ?n ?x)
+      (true (cell 1 ?n ?x))
+      (true (cell 2 ?n ?x))
+      (true (cell 3 ?n ?x)))
+
+  (<= (diagonal ?x)
+      (true (cell 1 1 ?x))
+      (true (cell 2 2 ?x))
+      (true (cell 3 3 ?x)))
+
+  (<= (diagonal ?x)
+      (true (cell 1 3 ?x))
+      (true (cell 2 2 ?x))
+      (true (cell 3 1 ?x)))
+
+  (<= (line ?x) (row ?m ?x))
+  (<= (line ?x) (column ?m ?x))
+  (<= (line ?x) (diagonal ?x))
+
+  (<= open
+      (true (cell ?m ?n b)))
+
+  (<= (next (control oplayer))
+      (does xplayer (mark ?x ?y))
+      (legal xplayer (mark ?x ?y))
+      (true (cell ?x ?y b))
+      (true (control xplayer)))
+
+  (<= (next (control xplayer))
+      (does xplayer (mark ?x ?y))
+      (legal xplayer (mark ?x ?y))
+      (true (cell ?x ?y o))
+      (true (control xplayer)))
+
+  (<= (next (control xplayer))
+      (does oplayer (mark ?x ?y))
+      (legal oplayer (mark ?x ?y))
+      (true (cell ?x ?y b))
+      (true (control oplayer)))
+
+  (<= (next (control oplayer))
+      (does oplayer (mark ?x ?y))
+      (legal oplayer (mark ?x ?y))
+      (true (cell ?x ?y x))
+      (true (control oplayer)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Sees terms
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (<= (sees oplayer controlo)
+      (does oplayer (mark ?x ?y))
+      (legal oplayer (mark ?x ?y))
+      (true (cell ?x ?y x))
+      (true (control oplayer)))
+
+  (<= (sees xplayer controlx)
+      (does xplayer (mark ?x ?y))
+      (legal xplayer (mark ?x ?y))
+      (true (cell ?x ?y o))
+      (true (control xplayer)))
+
+  (<= (sees xplayer controlx)
+      (does oplayer (mark ?x ?y))
+      (legal oplayer (mark ?x ?y))
+      (true (cell ?x ?y b))
+      (true (control oplayer)))
+
+  (<= (sees oplayer controlo)
+      (does xplayer (mark ?x ?y))
+      (legal xplayer (mark ?x ?y))
+      (true (cell ?x ?y b))
+      (true (control xplayer)))
+
+  (<= (sees ?w (mark ?x ?y))
+      (does ?w (mark ?x ?y))
+      (legal ?w (mark ?x ?y)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Legality of moves
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (<= (legal xplayer (mark ?x ?y))
+      (true (deniedx ?x ?y b))
+      (true (control xplayer)))
+
+  (<= (legal oplayer (mark ?x ?y))
+      (true (deniedo ?x ?y b))
+      (true (control oplayer)))
+
+  (<= (legal xplayer noop)
+      (true (control oplayer)))
+
+  (<= (legal oplayer noop)
+      (true (control xplayer)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Goals
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (<= (goal xplayer 100)
+      (line x))
+
+  (<= (goal xplayer 50)
+      (not (line x))
+      (not (line o))
+      (not open))
+
+  (<= (goal xplayer 0)
+      (line o))
+
+  (<= (goal oplayer 100)
+      (line o))
+
+  (<= (goal oplayer 50)
+      (not (line x))
+      (not (line o))
+      (not open))
+
+  (<= (goal oplayer 0)
+      (line x))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Terminal states
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+  (<= terminal
+      (line x))
+
+  (<= terminal
+      (line o))
+
+  (<= terminal
+      (not open))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/mastermind.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,471 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Mastermind
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Version with four colors, four places and 8 chances to make the
+;;; right guess. After each move, the player is informed exactly
+;;; which colors were guessed correctly.
+;;;
+;;; GDL description by Tim Federholzner and Peter Kissmann
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; roles
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(role random)
+(role player)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; initial state
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The step counter is initialized to the setup phase.
+(init (guess setup))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; legal rules
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The random player sets up the colors in the first step.
+(<= (legal random (set ?c1 ?c2 ?c3 ?c4))
+    (true (guess setup))
+    (color ?c1)
+    (color ?c2)
+    (color ?c3)
+    (color ?c4)
+)
+
+;;; After the first step the random player can only watch the actual
+;;; player.
+(<= (legal random watch)
+    (true (guess ?g))
+    (distinct ?g setup)
+)
+
+;;; In the first step the actual player has to wait.
+(<= (legal player wait)
+    (true (guess setup))
+)
+
+;;; After the first step the actual player can guess the four colors.
+(<= (legal player (guessColors ?c1 ?c2 ?c3 ?c4))
+    (true (guess ?g))
+    (distinct ?g setup)
+    (color ?c1)
+    (color ?c2)
+    (color ?c3)
+    (color ?c4)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; next rules
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The four places are colored the way chosen by the random player.
+(<= (next (set 1 ?c1))
+    (does random (set ?c1 ?c2 ?c3 ?c4))
+)
+(<= (next (set 2 ?c2))
+    (does random (set ?c1 ?c2 ?c3 ?c4))
+)
+(<= (next (set 3 ?c3))
+    (does random (set ?c1 ?c2 ?c3 ?c4))
+)
+(<= (next (set 4 ?c4))
+    (does random (set ?c1 ?c2 ?c3 ?c4))
+)
+
+;;; Once colored the places do not change their color.
+(<= (next (set ?n ?c))
+    (true (set ?n ?c))
+)
+
+;;; The last move is stored (in order to use it in the terminal and
+;;; goal descriptions).
+(<= (next (playerset ?c1 ?c2 ?c3 ?c4))
+    (does player (guessColors ?c1 ?c2 ?c3 ?c4))
+)
+
+;;; Increasing the step counter.
+(<= (next (guess ?g2))
+    (true (guess ?g1))
+    (succ ?g1 ?g2)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; visualization fluents
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(slot 1)
+(slot 2)
+(slot 3)
+(slot 4)
+
+(<= (next (cell 1 ?n ?c1))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+)
+(<= (next (cell 2 ?n ?c2))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+)
+(<= (next (cell 3 ?n ?c3))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+)
+(<= (next (cell 4 ?n ?c4))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+)
+
+(<= (next (cell ?slot ?number ?color))
+	(true (cell ?slot ?number ?color))
+)
+
+(<= (next (cell 5 ?n white))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(not (true (set 1 ?c1)))
+)
+(<= (next (cell 6 ?n white))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(not (true (set 2 ?c2)))
+)
+(<= (next (cell 7 ?n white))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(not (true (set 3 ?c3)))
+)
+(<= (next (cell 8 ?n white))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(not (true (set 4 ?c4)))
+)
+
+(<= (next (cell 5 ?n black))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(true (set 1 ?c1))
+)
+(<= (next (cell 6 ?n black))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(true (set 2 ?c2))
+)
+(<= (next (cell 7 ?n black))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(true (set 3 ?c3))
+)
+(<= (next (cell 8 ?n black))
+	(does player (guessColors ?c1 ?c2 ?c3 ?c4))
+	(true (guess ?n0))
+	(succ ?n0 ?n)
+	(true (set 4 ?c4))
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; sees rules
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The random player knows all moves.
+(<= (sees random (does ?r ?m))
+    (does ?r ?m)
+)
+
+;;; The actual player sees only its own moves - to ensure that it
+;;; knows which move has been performed in case of a timeout or
+;;; similar.
+(<= (sees player (does player ?m))
+    (does player ?m)
+)
+
+;;; The player is informed of all colors correctly guessed.
+(<= (sees player (set 1 ?c1))
+    (does player (guessColors ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+)
+(<= (sees player (set 2 ?c2))
+    (does player (guessColors ?c1 ?c2 ?c3 ?c4))
+    (true (set 2 ?c2))
+)
+(<= (sees player (set 3 ?c3))
+    (does player (guessColors ?c1 ?c2 ?c3 ?c4))
+    (true (set 3 ?c3))
+)
+(<= (sees player (set 4 ?c4))
+    (does player (guessColors ?c1 ?c2 ?c3 ?c4))
+    (true (set 4 ?c4))
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; terminal states
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The game ends after eight guesses.
+(<= terminal
+    (true (guess 8))
+)
+
+;;; The game also ends once the player has guessed the colors of all
+;;; four places correctly.
+(<= terminal
+    fourMatches
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; goal definitions
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The random player always gets 100 points.
+(goal random 100)
+
+;;; A good player should be able to find the correct solution in at
+;;; most four guesses, which results in 100 points.
+(<= (goal player 100)
+    (true (guess 1))
+    fourMatches
+)
+(<= (goal player 100)
+    (true (guess 2))
+    fourMatches
+)
+(<= (goal player 100)
+    (true (guess 3))
+    fourMatches
+)
+(<= (goal player 100)
+    (true (guess 4))
+    fourMatches
+)
+
+;;; If guessing all colors correctly took longer than four guesses
+;;; the reward is successively decreased.
+(<= (goal player 95)
+    (true (guess 5))
+    fourMatches
+)
+
+(<= (goal player 90)
+    (true (guess 6))
+    fourMatches
+)
+
+(<= (goal player 85)
+    (true (guess 7))
+    fourMatches
+)
+
+(<= (goal player 80)
+    (true (guess 8))
+    fourMatches
+)
+
+;;; Guessing less than four colors correctly in the final try results
+;;; in successively decreasing rewards.
+(<= (goal player 50)
+    (true (guess 8))
+    threeMatches
+)
+
+(<= (goal player 35)
+    (true (guess 8))
+    twoMatches
+)
+
+(<= (goal player 15)
+    (true (guess 8))
+    oneMatch
+)
+
+(<= (goal player 0)
+    (true (guess 8))
+    noMatch
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; utility rules
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; The possible colors.
+(color red)
+(color blue)
+(color green)
+(color pink)
+
+;;; The successor relation (needed for the step counter "guess").
+(succ setup start)
+(succ start 1)
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+
+;;; All colors guessed correctly in the last guess.
+(<= fourMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?c2))
+    (true (set 3 ?c3))
+    (true (set 4 ?c4))
+)
+
+;;; In the last guess exactly three colors matched.
+(<= threeMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?c2))
+    (true (set 3 ?c3))
+    (true (set 4 ?c4))
+    (distinct ?s1 ?c1)
+)
+(<= threeMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?s2))
+    (true (set 3 ?c3))
+    (true (set 4 ?c4))
+    (distinct ?s2 ?c2)
+)
+(<= threeMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?c2))
+    (true (set 3 ?s3))
+    (true (set 4 ?c4))
+    (distinct ?s3 ?c3)
+)
+(<= threeMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?c2))
+    (true (set 3 ?c3))
+    (true (set 4 ?s4))
+    (distinct ?s4 ?c4)
+)
+
+;;; In the last guess exactly two colors matched.
+(<= twoMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?c2))
+    (true (set 3 ?s3))
+    (true (set 4 ?s4))
+    (distinct ?s3 ?c3)
+    (distinct ?s4 ?c4)
+)
+(<= twoMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?s2))
+    (true (set 3 ?c3))
+    (true (set 4 ?s4))
+    (distinct ?s2 ?c2)
+    (distinct ?s4 ?c4)
+)
+(<= twoMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?s2))
+    (true (set 3 ?s3))
+    (true (set 4 ?c4))
+    (distinct ?s2 ?c2)
+    (distinct ?s3 ?c3)
+)
+(<= twoMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?c2))
+    (true (set 3 ?c3))
+    (true (set 4 ?s4))
+    (distinct ?s1 ?c1)
+    (distinct ?s4 ?c4)
+)
+(<= twoMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?c2))
+    (true (set 3 ?s3))
+    (true (set 4 ?c4))
+    (distinct ?s1 ?c1)
+    (distinct ?s3 ?c3)
+)
+(<= twoMatches
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?s2))
+    (true (set 3 ?c3))
+    (true (set 4 ?c4))
+    (distinct ?s1 ?c1)
+    (distinct ?s2 ?c2)
+)
+
+;;; In the last guess exactly one color matched.
+(<= oneMatch
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?c1))
+    (true (set 2 ?s2))
+    (true (set 3 ?s3))
+    (true (set 4 ?s4))
+    (distinct ?s2 ?c2)
+    (distinct ?s3 ?c3)
+    (distinct ?s4 ?c4)
+)
+(<= oneMatch
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?c2))
+    (true (set 3 ?s3))
+    (true (set 4 ?s4))
+    (distinct ?s1 ?c1)
+    (distinct ?s3 ?c3)
+    (distinct ?s4 ?c4)
+)
+(<= oneMatch
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?s2))
+    (true (set 3 ?c3))
+    (true (set 4 ?s4))
+    (distinct ?s1 ?c1)
+    (distinct ?s2 ?c2)
+    (distinct ?s4 ?c4)
+)
+(<= oneMatch
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?s2))
+    (true (set 3 ?s3))
+    (true (set 4 ?c4))
+    (distinct ?s1 ?c1)
+    (distinct ?s2 ?c2)
+    (distinct ?s3 ?c3)
+)
+
+;;; The last guess was completely incorrect.
+(<= noMatch
+    (true (playerset ?c1 ?c2 ?c3 ?c4))
+    (true (set 1 ?s1))
+    (true (set 2 ?s2))
+    (true (set 3 ?s3))
+    (true (set 4 ?s4))
+    (distinct ?s1 ?c1)
+    (distinct ?s2 ?c2)
+    (distinct ?s3 ?c3)
+    (distinct ?s4 ?c4)
+)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/small_dominion.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,92 @@
+(role duke) (role earl) (role random)
+(init (control random))
+(init (deck duke 0 copper)) (init (deck duke 1 copper)) (init (deck duke 2 copper)) (init (deck duke 3 copper)) (init (deck duke 4 estate)) (init (deck duke 5 estate)) (init (decksize duke 5)) (init (victory duke 2)) (init (deck earl 0 copper)) (init (deck earl 1 copper)) (init (deck earl 2 copper)) (init (deck earl 3 copper)) (init (deck earl 4 estate)) (init (deck earl 5 estate)) (init (decksize earl 5)) (init (victory earl 2))
+(init (table 10 estate)) (init (table 5 duchy)) (init (table 30 copper)) (init (table 5 silver))
+(value copper 1) (value silver 2) (value estate 0) (value duchy 0)
+(points estate 1) (points duchy 4) (points copper 0) (points silver 0)
+(cost copper 0) (cost silver 2) (cost estate 1) (cost duchy 3)
+
+; a hand is 3 random cards (discarded + bought cards are shuffled in immediately)
+(<= (legal random (deal ?player ?a ?b ?c)) (role ?player) (distinct ?player random) (not (true (control ?player))) (not (true (control random))) (true (decksize ?player ?x)) (greater_than_equals ?x ?a) (greater_than_equals ?x ?b) (distinct ?a ?b) (greater_than_equals ?x ?c) (distinct ?a ?c) (distinct ?b ?c))
+(<= (legal random (deal duke ?a ?b ?c)) (true (control random)) (true (decksize duke ?x)) (greater_than_equals ?x ?a) (greater_than_equals ?x ?b) (distinct ?a ?b) (greater_than_equals ?x ?c) (distinct ?a ?c) (distinct ?b ?c))
+
+(<= (legal ?player noop) (true dealing) (role ?player) (distinct ?player random))
+(<= (legal ?player (buy copper)) (true (control ?player)) (distinct ?player random))
+(<= (legal ?player (buy ?card))
+	(true (control ?player)) (distinct ?player random) (cost ?card ?price) (true (money ?player ?x)) (greater_than_equals ?x ?price) (true (table ?y ?card))
+	;(greater_than_equals ?y 1)
+	(distinct ?y 0)
+	)
+
+; unsafe rule
+; (<= (legal ?player noop) (not (true (control ?player))) (distinct ?player random))
+; fixed version
+(<= (legal ?player noop) (role ?player) (not (true (control ?player))) (distinct ?player random))
+
+(<= (sees ?player (hand ?a ?b ?c)) (does random (deal ?player ?a ?b ?c)))
+; unsafe rule
+; (<= (sees ?player (table ?x ?card)) (true (table ?y ?card)) (does ?anyplayer (buy ?card)) (++ ?x ?y))
+; fixed version
+(<= (sees ?player (table ?x ?card)) (role ?player) (true (table ?y ?card)) (does ?anyplayer (buy ?card)) (++ ?x ?y))
+
+(<= (next (money ?player ?x))
+	(role ?player)
+	(does random (deal ?player ?a ?b ?c))
+	(true (deck ?player ?a ?carda))
+	(true (deck ?player ?b ?cardb))
+	(true (deck ?player ?c ?cardc))
+	(value ?carda ?i)
+	(value ?cardb ?j)
+	(value ?cardc ?k)
+	(add ?i ?j ?l)
+	(add ?k ?l ?x))
+
+(<= (next (deck ?player ?x ?card)) (true (deck ?player ?x ?card)))
+(<= (next (deck ?player ?index ?card)) (true (decksize ?player ?size)) (++ ?size ?index) (does ?player (buy ?card)))
+(<= (next (decksize ?player ?x)) (true (decksize ?player ?x)) (not (true (control ?player))))
+(<= (next (decksize ?player ?y)) (true (decksize ?player ?x)) (++ ?x ?y) (true (control ?player)))
+(<= (next (victory ?player ?x)) (true (victory ?player ?x)) (not (true (control ?player))))
+(<= (next (victory ?player ?new)) (true (victory ?player ?old)) (does ?player (buy ?card)) (points ?card ?pts) (add ?pts ?old ?new)) 
+(<= (next (table ?x ?card)) (true (table ?x ?card)) (true (control random)))
+(<= (next (table ?x ?card)) (true (table ?x ?card)) (does ?player (buy ?othercard)) (distinct ?card ?othercard))
+(<= (next (table ?x ?card)) (true (table ?y ?card)) (does ?player (buy ?card)) (++ ?x ?y))
+(<= (next (control duke)) (true (control random)))
+(<= (next (control earl)) (true (control duke)))
+(<= (next (control duke)) (true (control earl)))
+(<= terminal (true (table 0 duchy)))
+(<= terminal (true (table 0 estate)) (true (table 0 silver)))
+(<= terminal (true (table 0 copper)))
+
+(<= (goal ?player 100)
+	(true (victory ?player ?x)) (true (victory ?opponent ?y)) (distinct ?player ?opponent)
+	(greater_than_equals ?x ?y)
+	; made this faster
+	; (not (greater_than_equals ?y ?x))
+	(distinct ?x ?y)
+)
+(<= (goal ?player 50) (true (victory ?player ?x)) (true (victory ?opponent ?x)) (distinct ?player ?opponent))
+
+(<= (goal ?player 0)
+	(true (victory ?player ?x))
+	(true (victory ?opponent ?y))
+	(distinct ?player ?opponent)
+	(greater_than_equals ?y ?x)
+	; fixed this:
+	; (not (greater_than_equals ?y ?x))
+	; made this faster
+	;(not (greater_than_equals ?x ?y))
+	(distinct ?x ?y)
+)
+
+; added this:
+(goal random 0)
+
+(<= (greater_than_equals ?x ?x) (++ ?x ?y))
+(<= (greater_than_equals ?x ?y) (++ ?y ?x))
+(<= (greater_than_equals ?x ?y) (++ ?z ?x) (greater_than_equals ?z ?y))
+
+(<= (add 0 ?prev ?prev) (++ ?prev ?x))
+(<= (add 1 ?y ?z) (++ ?y ?z))
+(<= (add ?x ?y ?z) (++ ?littlex ?x) (add ?littlex ?y ?littlez) (++ ?littlez ?z))
+
+(++ 0 1) (++ 1 2) (++ 2 3) (++ 3 4) (++ 4 5) (++ 5 6) (++ 6 7) (++ 7 8) (++ 8 9) (++ 9 10) (++ 10 11) (++ 11 12) (++ 12 13) (++ 13 14) (++ 14 15) (++ 15 16) (++ 16 17) (++ 17 18) (++ 18 19) (++ 19 20) (++ 20 21) (++ 21 22) (++ 22 23) (++ 23 24) (++ 24 25) (++ 25 26) (++ 26 27) (++ 27 28) (++ 28 29) (++ 29 30) (++ 30 31) (++ 31 32) (++ 32 33) (++ 33 34) (++ 34 35) (++ 35 36) (++ 36 37) (++ 37 38) (++ 38 39) (++ 39 40) (++ 40 41) (++ 41 42) (++ 42 43) (++ 43 44) (++ 44 45) (++ 45 46) (++ 46 47) (++ 47 48) (++ 48 49) (++ 49 50) (++ 50 51) (++ 51 52) (++ 52 53) (++ 53 54) (++ 54 55) (++ 55 56) (++ 56 57) (++ 57 58) (++ 58 59) (++ 59 60) (++ 60 61) (++ 61 62) (++ 62 63) (++ 63 64) (++ 64 65) (++ 65 66) (++ 66 67) (++ 67 68) (++ 68 69) (++ 69 70) (++ 70 71) (++ 71 72) (++ 72 73) (++ 73 74) (++ 74 75) (++ 75 76) (++ 76 77) (++ 77 78) (++ 78 79) (++ 79 80) (++ 80 81) (++ 81 82) (++ 82 83) (++ 83 84) (++ 84 85) (++ 85 86) (++ 86 87) (++ 87 88) (++ 88 89) (++ 89 90) 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/stratego.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,423 @@
+(role red)
+(role blue)
+
+(x 1)
+(x 2)
+(x 3)
+
+(y 1)
+(y 2)
+(y 3)
+(y 4)
+(y 5)
+(y 6)
+
+(piece flag)
+(piece bomb)
+(piece spy)
+(piece marshal)
+(piece miner)
+(piece scout)
+
+(immobile flag)
+(immobile bomb)
+
+(<= (init (cell ?x 3 b))
+	(x ?x)
+)
+
+(<= (init (cell ?x 4 b))
+	(x ?x)
+)
+
+(<= (init (inPool ?r ?p))
+	(role ?r)
+	(piece ?p)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(order red 1 1 1)
+(order red 2 2 1)
+(order red 3 3 1)
+(order red 4 1 2)
+(order red 5 2 2)
+(order red 6 3 2)
+
+(order blue 1 1 5)
+(order blue 2 2 5)
+(order blue 3 3 5)
+(order blue 4 1 6)
+(order blue 5 2 6)
+(order blue 6 3 6)
+
+(<= (legal ?r (place ?x ?y ?p))
+	(role ?r)
+	(true (step ?s))
+	(order ?r ?s ?x ?y)
+	(true (inPool ?r ?p))
+)
+
+(<= (placed ?r ?p)
+	(does ?r (place ?x ?y ?p))
+)
+
+(<= (next (inPool ?r ?p))
+	(true (inPool ?r ?p))
+	(not (placed ?r ?p))
+)
+
+(<= (next (cell ?x ?y ?p))
+	(does ?r (place ?x ?y ?p))
+)
+
+(<= (next (occupied ?x ?y ?r))
+	(does ?r (place ?x ?y ?p))
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; move for spy, miner and marshal
+(<= (legal ?r (move ?x ?y ?x2 ?y2))
+	(role ?r)
+	playingPhase
+	(true (turn ?r))
+	(true (occupied ?x ?y ?r))
+	(true (cell ?x ?y ?p))
+	(adjacent ?x ?y ?x2 ?y2)
+	(not (immobile ?p))
+	(not (true (occupied ?x2 ?y2 ?r)))
+)
+
+;;; special move for scout
+(<= (legal ?r (move ?x ?y ?x3 ?y3))
+	(role ?r)
+	playingPhase
+	(true (turn ?r))
+	(true (occupied ?x ?y ?r))
+	(true (cell ?x ?y scout))
+	(adjacent ?x ?y ?x2 ?y2)
+	(adjacent ?x2 ?y2 ?x3 ?y3)
+	(true (cell ?x2 ?y2 b))
+	(not (true (occupied ?x3 ?y3 ?r)))
+)
+
+(<= (legal ?r noop)
+	(role ?r)
+	playingPhase
+	(not (true (turn ?r)))
+)
+
+(<= (anyMobile ?r)
+	(role ?r)
+	playingPhase
+	(true (occupied ?x ?y ?r))
+	(true (cell ?x ?y ?p))
+	(adjacent ?x ?y ?x2 ?y2)
+	(not (immobile ?p))
+	(not (true (occupied ?x2 ?y2 ?r)))
+)
+
+(<= (legal ?r noop)
+	(role ?r)
+	playingPhase
+	(true (turn ?r))
+	(not (anyMobile ?r))
+)
+
+(<= (anyMoveFrom ?x ?y)
+	(does ?r (move ?x ?y ?x2 ?y2))
+)
+
+(<= (anyMoveTo ?x2 ?y2)
+	(does ?r (move ?x ?y ?x2 ?y2))
+)
+
+(<= (next (cell ?x ?y ?p))
+	(true (cell ?x ?y ?p))
+	(not (anyMoveFrom ?x ?y))
+	(not (anyMoveTo ?x ?y))
+)
+
+(<= (next (cell ?x ?y b))
+	(does ?r (move ?x ?y ?x2 ?y2))
+)
+
+(<= (next (occupied ?x ?y ?r))
+	(true (occupied ?x ?y ?r))
+	(not (anyMoveFrom ?x ?y))
+	(not (anyMoveTo ?x ?y))
+)
+
+(<= (next (cell ?x ?y ?p))
+	(true (cell ?x0 ?y0 ?p))
+	(does ?r (move ?x0 ?y0 ?x ?y))
+	(role ?r2)
+	(not (true (occupied ?x ?y ?r2)))
+	(distinct ?r ?r2)
+)
+
+(<= (next (occupied ?x ?y ?r))
+	(true (occupied ?x0 ?y0 ?r))
+	(does ?r (move ?x0 ?y0 ?x ?y))
+	(role ?r2)
+	(not (true (occupied ?x ?y ?r2)))
+	(distinct ?r ?r2)
+)
+
+(<= (sees ?r (did ?r ?m))
+	(does ?r ?m)
+)
+
+(<= (sees ?r (did ?r2 (move ?x ?y ?x2 ?y2)))
+	(role ?r)
+	(does ?r2 (move ?x ?y ?x2 ?y2))
+	(distinct ?r ?r2)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (sees ?r (cell ?x ?y ?p))
+	(true (cell ?x ?y ?p))
+	(true (occupied ?x ?y ?r2))
+	(does ?r (move ?x0 ?y0 ?x ?y))
+	(distinct ?r ?r2)
+)
+
+(<= (sees ?r (cell ?x ?y ?p))
+	(role ?r)
+	(does ?r2 (move ?x ?y ?x2 ?y2))
+	(true (occupied ?x2 ?y2 ?r))
+	(true (cell ?x ?y ?p))
+)
+
+(<= (next (cell ?x ?y ?p))
+	(true (cell ?x ?y ?p))
+	(true (occupied ?x ?y ?r))
+	(does ?r2 (move ?x0 ?y0 ?x ?y))
+	(distinct ?r ?r2)
+	(true (cell ?x0 ?y0 ?p0))
+	(beats ?p0 ?p ?p)
+)
+
+(<= (next (cell ?x ?y ?p0))
+	(true (cell ?x ?y ?p))
+	(true (occupied ?x ?y ?r))
+	(does ?r2 (move ?x0 ?y0 ?x ?y))
+	(distinct ?r ?r2)
+	(true (cell ?x0 ?y0 ?p0))
+	(beats ?p0 ?p ?p0)
+)
+
+(<= (next (cell ?x ?y b))
+	(true (cell ?x ?y ?p))
+	(true (occupied ?x ?y ?r))
+	(does ?r2 (move ?x0 ?y0 ?x ?y))
+	(distinct ?r ?r2)
+	(true (cell ?x0 ?y0 ?p))
+)
+
+(<= (next (occupied ?x ?y ?r))
+	(true (cell ?x ?y ?p))
+	(true (occupied ?x ?y ?r))
+	(does ?r2 (move ?x0 ?y0 ?x ?y))
+	(distinct ?r ?r2)
+	(true (cell ?x0 ?y0 ?p0))
+	(beats ?p0 ?p ?p)
+)
+
+(<= (next (occupied ?x ?y ?r2))
+	(true (cell ?x ?y ?p))
+	(true (occupied ?x ?y ?r))
+	(does ?r2 (move ?x0 ?y0 ?x ?y))
+	(distinct ?r ?r2)
+	(true (cell ?x0 ?y0 ?p0))
+	(beats ?p0 ?p ?p0)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(<= (anyFlag ?r)
+	(true (cell ?x ?y flag))
+	(true (occupied ?x ?y ?r))
+)
+
+(<= playingPhase
+	(not (true (step 1)))
+	(not (true (step 2)))
+	(not (true (step 3)))
+	(not (true (step 4)))
+	(not (true (step 5)))
+	(not (true (step 6)))
+)
+
+(<= terminal
+	(role ?r)
+	(not (anyFlag ?r))
+	playingPhase
+)
+
+(<= terminal
+	playingPhase
+	(not (anyMobile red))
+	(not (anyMobile blue))
+)
+
+(<= terminal
+	(true (step 51))
+)
+
+(<= (goal red 100)
+	(not (anyFlag blue))
+)
+
+(<= (goal blue 100)
+	(not (anyFlag red))
+)
+
+(<= (goal ?r 50)
+	(role ?r)
+	(anyFlag red)
+	(anyFlag blue)
+	(true (step 51))
+)
+
+(<= (goal ?r 50)
+	(role ?r)
+	(anyFlag red)
+	(anyFlag blue)
+	(not (anyMobile red))
+	(not (anyMobile blue))
+)
+
+(<= (goal red 0)
+	(not (anyFlag red))
+)
+
+(<= (goal blue 0)
+	(not (anyFlag blue))
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; attacker, defender, winner
+;;; if attacker and defender are equal, both lose
+
+(beats spy flag spy)
+(beats spy bomb bomb)
+(beats spy marshal spy)
+(beats spy miner miner)
+(beats spy scout scout)
+
+(beats marshal flag marshal)
+(beats marshal bomb bomb)
+(beats marshal spy marshal)
+(beats marshal miner marshal)
+(beats marshal scout marshal)
+
+(beats miner flag miner)
+(beats miner bomb miner)
+(beats miner spy miner)
+(beats miner marshal marshal)
+(beats miner scout miner)
+
+(beats scout flag scout)
+(beats scout bomb bomb)
+(beats scout spy scout)
+(beats scout marshal marshal)
+(beats scout miner miner)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(cellsucc 1 2)
+(cellsucc 2 3)
+(cellsucc 3 4)
+(cellsucc 4 5)
+(cellsucc 5 6)
+
+(<= (adjacent ?x ?y ?x ?y2)
+	(x ?x)
+	(cellsucc ?y ?y2)
+)
+(<= (adjacent ?x ?y ?x ?y2)
+	(x ?x)
+	(cellsucc ?y2 ?y)
+)
+(<= (adjacent ?x ?y ?x2 ?y)
+	(x ?x)
+	(x ?x2)
+	(y ?y)
+	(cellsucc ?x ?x2)
+)
+(<= (adjacent ?x ?y ?x2 ?y)
+	(x ?x)
+	(x ?x2)
+	(y ?y)
+	(cellsucc ?x2 ?x)
+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(init (turn red))
+(<= (next (turn blue))
+	(true (turn red))
+)
+(<= (next (turn red))
+	(true (turn blue))
+)
+
+(init (step 1))
+(<= (next (step ?n1))
+	(true (step ?n0))
+	(succ ?n0 ?n1)
+)
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+(succ 8 9)
+(succ 9 10)
+(succ 10 11)
+(succ 11 12)
+(succ 12 13)
+(succ 13 14)
+(succ 14 15)
+(succ 15 16)
+(succ 16 17)
+(succ 17 18)
+(succ 18 19)
+(succ 19 20)
+(succ 20 21)
+(succ 21 22)
+(succ 22 23)
+(succ 23 24)
+(succ 24 25)
+(succ 25 26)
+(succ 26 27)
+(succ 27 28)
+(succ 28 29)
+(succ 29 30)
+(succ 30 31)
+(succ 31 32)
+(succ 32 33)
+(succ 33 34)
+(succ 34 35)
+(succ 35 36)
+(succ 36 37)
+(succ 37 38)
+(succ 38 39)
+(succ 39 40)
+(succ 40 41)
+(succ 41 42)
+(succ 42 43)
+(succ 43 44)
+(succ 44 45)
+(succ 45 46)
+(succ 46 47)
+(succ 47 48)
+(succ 48 49)
+(succ 49 50)
+(succ 50 51)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/transit.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,186 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; transit
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(role transit)
+(role patrol)
+
+(blocked 1 5)
+(blocked 1 4)
+(blocked 5 1)
+(blocked 5 2)
+(blocked 5 3)
+(blocked 5 4)
+(blocked 5 5)
+(blocked 5 6)
+(blocked 5 7)
+(blocked 5 8)
+
+(init (control patrol))
+(init (location patrol 3 8))
+(init (location transit 2 1))
+(init (step 1))
+
+(<= (legal patrol (move ?dir))
+    (true (control patrol))
+    (true (location patrol ?x ?y))
+    (plegalstep ?dir ?x ?y))
+(<= (legal patrol (move nowhere))
+    (not (true (control patrol))))
+(<= (legal transit (move ?dir))
+    (true (control transit))
+    (true (location transit ?x ?y))
+    (tlegalstep ?dir ?x ?y))
+(<= (legal transit (move nowhere))
+    (not (true (control transit))))
+
+(<= (next (control patrol))
+    (true (control transit)))
+(<= (next (control transit))
+    (true (control patrol)))
+(<= (next (location ?char ?x2 ?y2))
+    (true (location ?char ?x1 ?y1))
+    (does ?char (move ?dir))
+    (nextcell ?dir ?x1 ?y1 ?x2 ?y2))
+(<= (next (step ?n++))
+    (true (step ?n))
+    (succ ?n ?n++)) 
+
+(<= terminal crossed)
+(<= terminal timeout)
+(<= terminal captured)
+
+(<= (goal patrol 100) timeout)
+(<= (goal transit 0) timeout)
+(<= (goal patrol 100) captured)
+(<= (goal transit 0) captured)
+(<= (goal transit 100) crossed)
+(<= (goal patrol 0) crossed)
+
+(<= crossed 
+    (true (location transit ?x 8))
+    (not captured))
+(<= timeout 
+    (true (step 30))
+    (not crossed)
+    (not captured))
+(<= captured 
+    (true (location transit ?x ?y))
+    (true (location patrol ?x ?y)))
+
+(<= (plegalstep north ?x ?y)
+    (++ ?y ?ynew)
+    (index ?x)
+    (not (blocked ?x ?ynew)))
+(<= (plegalstep south ?x ?y)
+    (++ ?ynew ?y)
+    (index ?x)
+    (not (blocked ?x ?ynew)))
+(<= (plegalstep east ?x ?y)
+    (++ ?x ?xnew)
+    (index ?y)
+    (not (blocked ?xnew ?y)))
+(<= (plegalstep west ?x ?y)
+    (++ ?xnew ?x)
+    (index ?y)
+    (not (blocked ?xnew ?y)))
+
+(<= (tlegalstep north ?x ?y)
+    (++ ?y ?ynew)
+    (index ?x)
+    (not (blocked ?x ?ynew)))
+(<= (tlegalstep deast ?x ?y)
+    (++ ?x ?xnew)
+    (++ ?y ?ynew)
+    (not (blocked ?xnew ?ynew)))
+(<= (tlegalstep dwest ?x ?y)
+    (++ ?xnew ?x)
+    (++ ?y ?ynew)
+    (not (blocked ?xnew ?ynew)))
+
+(<= (tlegalstep nowhere ?x ?y)
+    (index ?x)
+    (index ?y))
+(<= (plegalstep nowhere ?x ?y)
+    (index ?x)
+    (index ?y))
+
+(<= (nextcell north ?x ?y ?x ?ynew) 
+    (++ ?y ?ynew)
+    (index ?x))
+(<= (nextcell south ?x ?y ?x ?ynew)
+    (index ?x)
+    (++ ?ynew ?y))
+(<= (nextcell east ?x ?y ?xnew ?y)
+    (++ ?x ?xnew)
+    (index ?y))
+(<= (nextcell west ?x ?y ?xnew ?y)
+    (++ ?xnew ?x)
+    (index ?y))
+(<= (nextcell deast ?x ?y ?xnew ?ynew)
+    (++ ?y ?ynew)
+    (++ ?x ?xnew))
+(<= (nextcell dwest ?x ?y ?xnew ?ynew)
+    (++ ?y ?ynew)
+    (++ ?xnew ?x))
+(<= (nextcell nowhere ?x ?y ?x ?y)
+    (index ?x)
+    (index ?y))
+
+(index 1)
+(index 2)
+(index 3)
+(index 4)
+(index 5)
+(index 6)
+(index 7)
+(index 8)
+
+(++ 1 2)
+(++ 2 3)
+(++ 3 4)
+(++ 4 5)
+(++ 5 6)
+(++ 6 7)
+(++ 7 8)
+
+(succ 0 1)
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+(succ 8 9)
+(succ 9 10)
+(succ 10 11)
+(succ 11 12)
+(succ 12 13)
+(succ 13 14)
+(succ 14 15)
+(succ 15 16)
+(succ 16 17)
+(succ 17 18)
+(succ 18 19)
+(succ 19 20)
+(succ 20 21)
+(succ 21 22)
+(succ 22 23)
+(succ 23 24)
+(succ 24 25)
+(succ 25 26)
+(succ 26 27)
+(succ 27 28)
+(succ 28 29)
+(succ 29 30)
+
+(<= (sees ?r1 (location ?r2 ?x ?y))
+    (role ?r2)
+    (next (location ?r2 ?x ?y))
+    (next (location ?r1 ?x ?y))
+    (distinct ?r1 ?r2))
+(<= (sees patrol (location transit ?x 8))
+    (next (location transit ?x 8)))
+(<= (sees ?r (move ?dir))
+    (legal ?r (move ?dir)))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdl/vis_pacman3p.gdl	Tue Mar 14 16:35:43 2017 +0000
@@ -0,0 +1,484 @@
+(role pacman)
+(role blinky)
+(role inky)
+(init (control pacman))
+(init (location pacman 5 3))
+(init (location blinky 4 6))
+(init (location inky 5 6))
+(init (location pellet 3 1))
+(init (location pellet 4 1))
+(init (location pellet 5 1))
+(init (location pellet 6 1))
+(init (location pellet 3 2))
+(init (location pellet 6 2))
+(init (location pellet 1 3))
+(init (location pellet 2 3))
+(init (location pellet 3 3))
+(init (location pellet 4 3))
+(init (location pellet 6 3))
+(init (location pellet 7 3))
+(init (location pellet 8 3))
+(init (location pellet 1 4))
+(init (location pellet 3 4))
+(init (location pellet 6 4))
+(init (location pellet 8 4))
+(init (location pellet 1 5))
+(init (location pellet 3 5))
+(init (location pellet 6 5))
+(init (location pellet 8 5))
+(init (location pellet 1 6))
+(init (location pellet 2 6))
+(init (location pellet 3 6))
+(init (location pellet 6 6))
+(init (location pellet 7 6))
+(init (location pellet 8 6))
+(init (location pellet 3 7))
+(init (location pellet 6 7))
+(init (location pellet 3 8))
+(init (location pellet 4 8))
+(init (location pellet 5 8))
+(init (location pellet 6 8))
+(init (collected 0))
+(init (step 1))
+(<= (legal pacman (move ?dir))
+    (true (control pacman))
+    (true (location pacman ?x ?y))
+    (legalstep ?dir ?x ?y)
+    (distinct ?dir nowhere))
+(<= (legal pacman (move nowhere))
+    (not (true (control pacman))))
+(<= (legal ?ghost (move ?dir))
+    (ghost ?ghost)
+    (true (control ghosts))
+    (true (location ?ghost ?x ?y))
+    (legalstep ?dir ?x ?y)
+    (distinct ?dir nowhere))
+(<= (legal ?ghost (move nowhere))
+    (ghost ?ghost)
+    (not (true (control ghosts))))
+(<= (next (control pacman))
+    (true (control ghosts)))
+(<= (next (control ghosts))
+    (true (control pacman)))
+(<= (next (location pellet ?xp ?yp))
+    (true (location pellet ?xp ?yp))
+    (true (location pacman ?xpm1 ?ypm1))
+    (does pacman (move ?dir))
+    (nextcell ?dir ?xpm1 ?ypm1 ?xpm2 ?ypm2)
+    (distinctcell ?xp ?yp ?xpm2 ?ypm2))
+(<= (next (collected ?n++))
+    (true (location pacman ?x1 ?y1))
+    (does pacman (move ?dir))
+    (nextcell ?dir ?x1 ?y1 ?x2 ?y2)
+    (true (location pellet ?x2 ?y2))
+    (true (collected ?n))
+    (succ ?n ?n++))
+(<= (next (collected ?n))
+    (true (location pacman ?x1 ?y1))
+    (does pacman (move ?dir))
+    (nextcell ?dir ?x1 ?y1 ?x2 ?y2)
+    (not (true (location pellet ?x2 ?y2)))
+    (true (collected ?n)))
+(<= (next (location ?char ?x2 ?y2))
+    (movable ?char)
+    (true (location ?char ?x1 ?y1))
+    (does ?char (move ?dir))
+    (nextcell ?dir ?x1 ?y1 ?x2 ?y2))
+(<= (next (step ?n++))
+    (true (step ?n))
+    (succ ?n ?n++))
+(<= terminal
+    captured)
+(<= terminal
+    nopellets)
+(<= terminal
+    timeout)
+(<= (goal pacman ?g)
+    (true (collected ?n))
+    (scoremap ?n ?g))
+(<= (goal blinky 0)
+    (true (location pacman ?xp ?yp))
+    (true (location blinky ?xb ?yb))
+    (distinctcell ?xp ?yp ?xb ?yb))
+(<= (goal blinky 100)
+    (true (location pacman ?x ?y))
+    (true (location blinky ?x ?y)))
+(<= (goal inky 0)
+    (true (location pacman ?xp ?yp))
+    (true (location inky ?xi ?yi))
+    (distinctcell ?xp ?yp ?xi ?yi))
+(<= (goal inky 100)
+    (true (location pacman ?x ?y))
+    (true (location inky ?x ?y)))
+(<= (legalstep north ?x ?y)
+    (++ ?y ?ynew)
+    (cell ?x ?ynew)
+    (not (blocked ?x ?y ?x ?ynew)))
+(<= (legalstep south ?x ?y)
+    (-- ?y ?ynew)
+    (cell ?x ?ynew)
+    (not (blocked ?x ?y ?x ?ynew)))
+(<= (legalstep east ?x ?y)
+    (++ ?x ?xnew)
+    (cell ?xnew ?y)
+    (not (blocked ?x ?y ?xnew ?y)))
+(<= (legalstep west ?x ?y)
+    (-- ?x ?xnew)
+    (cell ?xnew ?y)
+    (not (blocked ?x ?y ?xnew ?y)))
+(<= (legalstep nowhere ?x ?y)
+    (cell ?x ?y))
+(<= (nextcell north ?x ?y ?x ?ynew)
+    (index ?x)
+    (++ ?y ?ynew))
+(<= (nextcell south ?x ?y ?x ?ynew)
+    (index ?x)
+    (-- ?y ?ynew))
+(<= (nextcell east ?x ?y ?xnew ?y)
+    (index ?y)
+    (++ ?x ?xnew))
+(<= (nextcell west ?x ?y ?xnew ?y)
+    (index ?y)
+    (-- ?x ?xnew))
+(<= (nextcell nowhere ?x ?y ?x ?y)
+    (cell ?x ?y))
+(<= (blocked ?x ?y1 ?x ?y2)
+    (blockednorth ?x ?y1)
+    (++ ?y1 ?y2))
+(<= (blocked ?x ?y2 ?x ?y1)
+    (blockednorth ?x ?y1)
+    (++ ?y1 ?y2))
+(<= (blocked ?x1 ?y ?x2 ?y)
+    (blockedeast ?x1 ?y)
+    (++ ?x1 ?x2))
+(<= (blocked ?x2 ?y ?x1 ?y)
+    (blockedeast ?x1 ?y)
+    (++ ?x1 ?x2))
+(<= (distinctcell ?x1 ?y1 ?x2 ?y2)
+    (cell ?x1 ?y1)
+    (cell ?x2 ?y2)
+    (distinct ?x1 ?x2))
+(<= (distinctcell ?x1 ?y1 ?x2 ?y2)
+    (cell ?x1 ?y1)
+    (cell ?x2 ?y2)
+    (distinct ?y1 ?y2))
+(<= captured
+    (true (location pacman ?x ?y))
+    (true (location blinky ?x ?y)))
+(<= captured
+    (true (location pacman ?x ?y))
+    (true (location inky ?x ?y)))
+(<= nopellets
+    (true (collected 35)))
+(<= timeout
+    (true (step 100)))
+
+(blockednorth 4 1)
+(blockednorth 5 1)
+(blockednorth 1 2)
+(blockednorth 2 2)
+(blockednorth 4 2)
+(blockednorth 5 2)
+(blockednorth 7 2)
+(blockednorth 8 2)
+(blockednorth 2 3)
+(blockednorth 4 3)
+(blockednorth 5 3)
+(blockednorth 7 3)
+(blockednorth 2 5)
+(blockednorth 4 5)
+(blockednorth 5 5)
+(blockednorth 7 5)
+(blockednorth 1 6)
+(blockednorth 2 6)
+(blockednorth 4 6)
+(blockednorth 5 6)
+(blockednorth 7 6)
+(blockednorth 8 6)
+(blockednorth 4 7)
+(blockednorth 5 7)
+(blockedeast 1 4)
+(blockedeast 1 5)
+(blockedeast 2 1)
+(blockedeast 2 2)
+(blockedeast 2 4)
+(blockedeast 2 5)
+(blockedeast 2 7)
+(blockedeast 2 8)
+(blockedeast 3 2)
+(blockedeast 3 4)
+(blockedeast 3 5)
+(blockedeast 3 7)
+(blockedeast 5 2)
+(blockedeast 5 4)
+(blockedeast 5 5)
+(blockedeast 5 7)
+(blockedeast 6 1)
+(blockedeast 6 2)
+(blockedeast 6 4)
+(blockedeast 6 5)
+(blockedeast 6 7)
+(blockedeast 6 8)
+(blockedeast 7 4)
+(blockedeast 7 5)
+
+(movable pacman)
+(movable blinky)
+(movable inky)
+(ghost blinky)
+(ghost inky)
+(index 1)
+(index 2)
+(index 3)
+(index 4)
+(index 5)
+(index 6)
+(index 7)
+(index 8)
+(cell 1 8)
+(cell 2 8)
+(cell 3 8)
+(cell 4 8)
+(cell 5 8)
+(cell 6 8)
+(cell 7 8)
+(cell 8 8)
+(cell 1 7)
+(cell 2 7)
+(cell 3 7)
+(cell 4 7)
+(cell 5 7)
+(cell 6 7)
+(cell 7 7)
+(cell 8 7)
+(cell 1 6)
+(cell 2 6)
+(cell 3 6)
+(cell 4 6)
+(cell 5 6)
+(cell 6 6)
+(cell 7 6)
+(cell 8 6)
+(cell 1 5)
+(cell 2 5)
+(cell 3 5)
+(cell 4 5)
+(cell 5 5)
+(cell 6 5)
+(cell 7 5)
+(cell 8 5)
+(cell 1 4)
+(cell 2 4)
+(cell 3 4)
+(cell 4 4)
+(cell 5 4)
+(cell 6 4)
+(cell 7 4)
+(cell 8 4)
+(cell 1 3)
+(cell 2 3)
+(cell 3 3)
+(cell 4 3)
+(cell 5 3)
+(cell 6 3)
+(cell 7 3)
+(cell 8 3)
+(cell 1 2)
+(cell 2 2)
+(cell 3 2)
+(cell 4 2)
+(cell 5 2)
+(cell 6 2)
+(cell 7 2)
+(cell 8 2)
+(cell 1 1)
+(cell 2 1)
+(cell 3 1)
+(cell 4 1)
+(cell 5 1)
+(cell 6 1)
+(cell 7 1)
+(cell 8 1)
+(++ 1 2)
+(++ 2 3)
+(++ 3 4)
+(++ 4 5)
+(++ 5 6)
+(++ 6 7)
+(++ 7 8)
+(-- 8 7)
+(-- 7 6)
+(-- 6 5)
+(-- 5 4)
+(-- 4 3)
+(-- 3 2)
+(-- 2 1)
+(succ 0 1)
+(succ 1 2)
+(succ 2 3)
+(succ 3 4)
+(succ 4 5)
+(succ 5 6)
+(succ 6 7)
+(succ 7 8)
+(succ 8 9)
+(succ 9 10)
+(succ 10 11)
+(succ 11 12)
+(succ 12 13)
+(succ 13 14)
+(succ 14 15)
+(succ 15 16)
+(succ 16 17)
+(succ 17 18)
+(succ 18 19)
+(succ 19 20)
+(succ 20 21)
+(succ 21 22)
+(succ 22 23)
+(succ 23 24)
+(succ 24 25)
+(succ 25 26)
+(succ 26 27)
+(succ 27 28)
+(succ 28 29)
+(succ 29 30)
+(succ 30 31)
+(succ 31 32)
+(succ 32 33)
+(succ 33 34)
+(succ 34 35)
+(succ 35 36)
+(succ 36 37)
+(succ 37 38)
+(succ 38 39)
+(succ 39 40)
+(succ 40 41)
+(succ 41 42)
+(succ 42 43)
+(succ 43 44)
+(succ 44 45)
+(succ 45 46)
+(succ 46 47)
+(succ 47 48)
+(succ 48 49)
+(succ 49 50)
+(succ 50 51)
+(succ 51 52)
+(succ 52 53)
+(succ 53 54)
+(succ 54 55)
+(succ 55 56)
+(succ 56 57)
+(succ 57 58)
+(succ 58 59)
+(succ 59 60)
+(succ 60 61)
+(succ 61 62)
+(succ 62 63)
+(succ 63 64)
+(succ 64 65)
+(succ 65 66)
+(succ 66 67)
+(succ 67 68)
+(succ 68 69)
+(succ 69 70)
+(succ 70 71)
+(succ 71 72)
+(succ 72 73)
+(succ 73 74)
+(succ 74 75)
+(succ 75 76)
+(succ 76 77)
+(succ 77 78)
+(succ 78 79)
+(succ 79 80)
+(succ 80 81)
+(succ 81 82)
+(succ 82 83)
+(succ 83 84)
+(succ 84 85)
+(succ 85 86)
+(succ 86 87)
+(succ 87 88)
+(succ 88 89)
+(succ 89 90)
+(succ 90 91)
+(succ 91 92)
+(succ 92 93)
+(succ 93 94)
+(succ 94 95)
+(succ 95 96)
+(succ 96 97)
+(succ 97 98)
+(succ 98 99)
+(succ 99 100)
+(scoremap 0 0)
+(scoremap 1 2)
+(scoremap 2 4)
+(scoremap 3 6)
+(scoremap 4 8)
+(scoremap 5 10)
+(scoremap 6 12)
+(scoremap 7 14)
+(scoremap 8 16)
+(scoremap 9 18)
+(scoremap 10 20)
+(scoremap 11 23)
+(scoremap 12 26)
+(scoremap 13 29)
+(scoremap 14 32)
+(scoremap 15 35)
+(scoremap 16 38)
+(scoremap 17 41)
+(scoremap 18 44)
+(scoremap 19 47)
+(scoremap 20 50)
+(scoremap 21 53)
+(scoremap 22 56)
+(scoremap 23 59)
+(scoremap 24 62)
+(scoremap 25 65)
+(scoremap 26 68)
+(scoremap 27 71)
+(scoremap 28 74)
+(scoremap 29 77)
+(scoremap 30 80)
+(scoremap 31 83)
+(scoremap 32 86)
+(scoremap 33 89)
+(scoremap 34 95)
+(scoremap 35 100)
+
+(<= (visible 1 ?y1 1 ?y2)
+    (index ?y1)
+    (index ?y2))
+(<= (visible 3 ?y1 3 ?y2)
+    (index ?y1)
+    (index ?y2))
+(<= (visible 6 ?y1 6 ?y2)
+    (index ?y1)
+    (index ?y2))
+(<= (visible 8 ?y1 8 ?y2)
+    (index ?y1)
+    (index ?y2))
+(<= (visible ?x1 1 ?x2 1)
+    (index ?x1)
+    (index ?x2))
+(<= (visible ?x1 3 ?x2 3)
+    (index ?x1)
+    (index ?x2))
+(<= (visible ?x1 6 ?x2 6)
+    (index ?x1)
+    (index ?x2))
+(<= (visible ?x1 8 ?x2 8)
+    (index ?x1)
+    (index ?x2))
+
+(<= (sees ?r1 (location ?r2 ?x2 ?y2))
+    (next (location ?r2 ?x2 ?y2))
+    (next (location ?r1 ?x1 ?y1))
+    (visible ?x1 ?y1 ?x2 ?y2))
+(<= (sees ?r1 (collected ?n))
+    (role ?r1)
+    (next (collected ?n)))
\ No newline at end of file
--- a/src/grounders/fluxplayer.lisp	Tue Mar 14 13:36:54 2017 +0000
+++ b/src/grounders/fluxplayer.lisp	Tue Mar 14 16:35:43 2017 +0000
@@ -73,28 +73,22 @@
           (negative-terms (.repeat negative-term-count
                                    (.whitespace-and (.positive-integer))))
           (positive-terms (.repeat (- term-count negative-term-count)
-                                   (.whitespace-and (.positive-integer))))
-          (_ (.char= #\newline)))
+                                   (.whitespace-and (.positive-integer)))))
     (.identity (make-rule :id id
                           :positive positive-terms
                           :negative negative-terms))))
 
-(defun .delimiter-line ()
-  (.progn (.char= #\0)
-          (.or (.char= #\newline)
-               (.eof))
-          (.identity nil)))
-
-(defun .grounded-gdl ()
-  (.let* ((rules (.first (.map 'list (.rule-line))))
-          (_ (.delimiter-line))
-          (index (.first (.map 'list (.index-line))))
-          (_ (.delimiter-line)))
-    (.identity (list rules index))))
-
 
 (defun parse-raw-grounded (raw)
-  (values (parse (.grounded-gdl) raw)))
+  (with-input-from-string (s raw)
+    (iterate
+      (with in-index = nil)
+      (for line :in-stream s :using #'read-line)
+      (cond
+        ((string= "0" line) (setf in-index t))
+        (in-index (collect (parse (.index-line) line) :into index))
+        (t (collect (parse (.rule-line) line) :into rules)))
+      (finally (return (list rules index))))))
 
 
 ;;;; Rebuilding ---------------------------------------------------------------
@@ -155,6 +149,7 @@
 ; (dump-grounded "8puzzle")
 ; (dump-grounded "tictactoe")
 
-(dump-grounded "montyhall")
+;; (dump-grounded "small_dominion")
 
-;; (dump-grounded "meier")
+
+;; (time (dump-grounded "meier"))
--- a/src/players/random-zdd.lisp	Tue Mar 14 13:36:54 2017 +0000
+++ b/src/players/random-zdd.lisp	Tue Mar 14 16:35:43 2017 +0000
@@ -18,9 +18,6 @@
                                (dump-gdl <> s))
                              (ground-gdl-string <>)))
            (reasoner (make-zdd-reasoner grounded-rules)))
-      (pr "GROUNDED:")
-      (pr grounded-rules)
-      (pr '------------------------------------)
       (setf (rp-role player) role
             (rp-reasoner player) reasoner)
       t)))
--- a/src/reasoners/zdd.lisp	Tue Mar 14 13:36:54 2017 +0000
+++ b/src/reasoners/zdd.lisp	Tue Mar 14 16:35:43 2017 +0000
@@ -12,7 +12,6 @@
     atom))
 
 (defun make-iset (reasoner contents)
-  ; (print-hash-table (zr-term->number reasoner))
   (zdd-set (mapcar (curry #'term-to-number reasoner)
                    (map-tree #'find-ggp-symbol contents))))
 
@@ -154,6 +153,7 @@
          (roles (find-roles rules)))
     (destructuring-bind (term->number number->term possible happens)
         (scully.terms::integerize-rules rules)
+      ;; (print-hash-table number->term)
       (with-zdd
         (make-instance 'zdd-reasoner
           :rules rules
@@ -167,10 +167,10 @@
                           (role (make-predicate-zdd `(ggp-rules::legal ,role)
                                                     term->number))))
           :goal-zdds (iterate
-                        (for role :in roles)
-                        (collect-hash
-                          (role (make-predicate-zdd `(ggp-rules::goal ,role)
-                                                    term->number))))
+                       (for role :in roles)
+                       (collect-hash
+                         (role (make-predicate-zdd `(ggp-rules::goal ,role)
+                                                   term->number))))
           :terminal-zdd (make-predicate-zdd '(ggp-rules::terminal) term->number)
           :next-zdd (make-predicate-zdd '(ggp-rules::next) term->number)
           :percept-universes
@@ -568,10 +568,11 @@
 (defparameter *rules* (scully.gdl::read-gdl "gdl/meier-grounded.gdl"))
 (defparameter *rules* (scully.gdl::read-gdl "gdl/pennies-grounded.gdl"))
 (defparameter *rules* (scully.gdl::read-gdl "gdl/montyhall-grounded.gdl"))
+(defparameter *rules* (scully.gdl::read-gdl "gdl/meier-grounded.gdl"))
+(defparameter *rules* (scully.gdl::read-gdl "gdl/kriegTTT_5x5-grounded.gdl"))
 
 (defparameter *r* nil)
-(defparameter *r* (make-zdd-reasoner *rules*))
-(defparameter *i* (initial-iset *r*))
+;; (defparameter *r* (make-zdd-reasoner *rules*))
 
 (defun test ()
   (with-zdd
--- a/src/rule-trees.lisp	Tue Mar 14 13:36:54 2017 +0000
+++ b/src/rule-trees.lisp	Tue Mar 14 16:35:43 2017 +0000
@@ -76,6 +76,7 @@
   (let* ((head (rule-head (first rules)))
          (top (top head))
          (cache (make-hash-table :test #'equal)))
+    ;; (pr head)
     (recursively ((bodies (mapcar (compose #'sort-body #'rule-body) rules)))
       (cond
         ((null bodies) bottom)