Open arr28 opened 8 years ago
And here's the KIF. This is a game of TTT with 10 "pies". Quirk is that the game isn't over until all 10 pies have been used.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Tictactoe with pies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Roles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(role player1)
(role player2)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Base & Input
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(index 1) (index 2) (index 3)
(marker x) (marker o)
(<= (base (cell ?x ?y b)) (index ?x) (index ?y))
(<= (base (cell ?x ?y x)) (index ?x) (index ?y))
(<= (base (cell ?x ?y o)) (index ?x) (index ?y))
(<= (base (control ?p)) (role ?p))
(base (piecount 0))
(<= (base (piecount ?np1))
(succ ?n ?np1))
(base debuglinex)
(base debuglineo)
(<= (base (usingMarker ?r ?m))
(role ?r)
(marker ?m))
(<= (input ?p (mark ?x ?y)) (index ?x) (index ?y) (role ?p))
(<= (input ?p noop) (role ?p))
(<= (input ?p swap) (role ?p))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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 (control player1))
(init (piecount 0))
(init (usingMarker player1 x))
(init (usingMarker player2 o))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dynamic Components
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Cell
(<= (next (cell ?x ?y ?m))
(does ?r (mark ?x ?y))
(true (usingMarker ?r ?m)))
(<= (next (cell ?x ?y ?m))
(true (cell ?x ?y ?m))
(distinct ?m b))
(<= (next (cell ?x ?y b))
(does ?r (mark ?j ?k))
(true (cell ?x ?y b))
(or (distinct ?x ?j) (distinct ?y ?k)))
(<= (next (cell ?x ?y b))
(true (cell ?x ?y b))
(does ?r swap)
(role ?r))
(<= (next (control player1))
(true (control player2)))
(<= (next (control player2))
(true (control player1)))
(<= (next (usingMarker ?r ?m))
(true (usingMarker ?r ?m))
(does ?s (mark ?j ?k))
(role ?s)
(index ?j)
(index ?k))
(<= (next (usingMarker player1 ?m))
(true (usingMarker player2 ?m))
(or (does player1 swap) (does player2 swap)))
(<= (next (usingMarker player2 ?m))
(true (usingMarker player1 ?m))
(or (does player1 swap) (does player2 swap)))
(<= (next (piecount ?np1))
(true (piecount ?n))
(succ ?n ?np1)
(does ?r swap)
(role ?r))
(<= (next (piecount ?n))
(true (piecount ?n))
(does ?r (mark ?j ?k))
(role ?r)
(index ?j)
(index ?k))
(<= (next debuglinex)
(line x))
(<= (next debuglineo)
(line o))
(<= (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)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(<= (legal ?w (mark ?x ?y))
(true (cell ?x ?y b))
(true (control ?w))
(not (line x))
(not (line o)))
(<= (legal ?w swap)
(true (control ?w))
(not (true (piecount 10))))
(<= (legal player2 noop)
(true (control player1)))
(<= (legal player1 noop)
(true (control player2)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(<= (goal ?r 100)
; (line ?m)
; (true (usingMarker ?r ?m)))
;(<= (goal ?r 0)
; (line ?m)
; (true (usingMarker ?r ?n))
; (distinct ?m ?n)
; (distinct ?m b))
(<= (goal player1 100)
(line x)
(true (piecount 10))
(true (usingMarker player1 x)))
(<= (goal player1 100)
(line o)
(true (piecount 10))
(true (usingMarker player1 o)))
(<= (goal player2 100)
(line x)
(true (piecount 10))
(true (usingMarker player2 x)))
(<= (goal player2 100)
(line o)
(true (piecount 10))
(true (usingMarker player2 o)))
(<= (goal player1 0)
(line o)
(true (piecount 10))
(true (usingMarker player1 x)))
(<= (goal player1 0)
(line x)
(true (piecount 10))
(true (usingMarker player1 o)))
(<= (goal player2 0)
(line o)
(true (piecount 10))
(true (usingMarker player2 x)))
(<= (goal player2 0)
(line x)
(true (piecount 10))
(true (usingMarker player2 o)))
(<= (goal player1 50)
(not (line x))
(not (line o))
(true (piecount 10))
(not open))
(<= (goal player2 50)
(not (line x))
(not (line o))
(true (piecount 10))
(not open))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(<= terminal
(line x)
(true (piecount 10)))
(<= terminal
(line o)
(true (piecount 10)))
(<= terminal
(not (line x))
(not (line o))
(not open)
(true (piecount 10)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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)
Issue is optimizeInputSets which considers inputs with arity 0 as noops, but swap has arity 0.
Playing a new game by Ed, Sancho lost against Random on its first outing. Made more alarming by the fact that it basically knew the game was a draw from the start.