gdl/kriegTTT_5x5.gdl @ 3f23f6b95cac

Fix parsing to not be recursive
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Mar 2017 16:35:43 +0000
parents (none)
children (none)
(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)