(role white)
(role black)

(<= (base (cell ?x ?y ?p)) (index ?x) (index ?y) (role ?p))
(<= (base (control ?p)) (role ?p))
(<= (input ?p noop) (role ?p))
(<= (input ?p (move ?x1 ?y1 ?x2 ?y2)) (role ?p) (index ?x1) (index ?x2) (index ?y1) (index ?y2))

(init (cell 1 1 white))
(init (cell 2 1 white))
(init (cell 3 1 white))
(init (cell 4 1 white))
(init (cell 5 1 white))
(init (cell 6 1 white))
(init (cell 1 2 white))
(init (cell 2 2 white))
(init (cell 3 2 white))
(init (cell 4 2 white))
(init (cell 5 2 white))
(init (cell 6 2 white))
(init (cell 1 5 black))
(init (cell 2 5 black))
(init (cell 3 5 black))
(init (cell 4 5 black))
(init (cell 5 5 black))
(init (cell 6 5 black))
(init (cell 1 6 black))
(init (cell 2 6 black))
(init (cell 3 6 black))
(init (cell 4 6 black))
(init (cell 5 6 black))
(init (cell 6 6 black))
(init (control white))

(<= (legal white noop)
    (true (control black)))
(<= (legal black noop)
    (true (control white)))

(<= (legal white (move ?x1 ?y1 ?x2 ?y2))
    (true (control white))
    (true (cell ?x1 ?y1 white))
    (whiteknightmove ?x1 ?y1 ?x2 ?y2)
    (not (true (cell ?x2 ?y2 white))))
(<= (legal black (move ?x1 ?y1 ?x2 ?y2))
    (true (control black))
    (true (cell ?x1 ?y1 black))
    (blackknightmove ?x1 ?y1 ?x2 ?y2)
    (not (true (cell ?x2 ?y2 black))))

(<= (next (cell ?x ?y ?state))
    (true (cell ?x ?y ?state))
    (does ?player (move ?x1 ?y1 ?x2 ?y2))
    (distinctcell ?x ?y ?x1 ?y1)
    (distinctcell ?x ?y ?x2 ?y2))
(<= (next (cell ?x2 ?y2 ?player))
    (does ?player (move ?x1 ?y1 ?x2 ?y2)))

(<= (next (control black))
    (true (control white)))
(<= (next (control white))
    (true (control black)))

(<= terminal
    whitewin)
(<= terminal
    blackwin)

(<= (goal white 100)
    whitewin)
(<= (goal white 0)
    blackwin)
(<= (goal black 100)
    blackwin)
(<= (goal black 0)
    whitewin)

(<= whitewin
    (index ?x)
    (true (cell ?x 6 white)))
(<= blackwin
    (index ?x)
    (true (cell ?x 1 black)))
(<= whitewin
    (not (hasanypiece black)))
(<= blackwin
    (not (hasanypiece white)))

(<= (hasanypiece ?player)
    (true (cell ?x ?y ?player)))

(<= (whiteknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 1 ?x1 ?x2)
    (pluss 2 ?y1 ?y2))
(<= (whiteknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 1 ?x2 ?x1)
    (pluss 2 ?y1 ?y2))
(<= (whiteknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 2 ?x1 ?x2)
    (pluss 1 ?y1 ?y2))
(<= (whiteknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 2 ?x2 ?x1)
    (pluss 1 ?y1 ?y2))
(<= (blackknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 1 ?x1 ?x2)
    (pluss 2 ?y2 ?y1))
(<= (blackknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 1 ?x2 ?x1)
    (pluss 2 ?y2 ?y1))
(<= (blackknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 2 ?x1 ?x2)
    (pluss 1 ?y2 ?y1))
(<= (blackknightmove ?x1 ?y1 ?x2 ?y2)
    (pluss 2 ?x2 ?x1)
    (pluss 1 ?y2 ?y1))

(<= (cell ?x ?y)
    (index ?x)
    (index ?y))
(<= (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))
(index 1)
(index 2)
(index 3)
(index 4)
(index 5)
(index 6)
(pluss 1 1 2)
(pluss 1 2 3)
(pluss 1 3 4)
(pluss 1 4 5)
(pluss 1 5 6)
(pluss 2 1 3)
(pluss 2 2 4)
(pluss 2 3 5)
(pluss 2 4 6)