;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Dots and Boxes ;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;; Roles ;;;;;;;;;;; (role misterx) (role mistery) ;;;;;;;; Initials ;;;;;;;; (<= (init (cell ?x ?y b)) (odd ?x) (even ?y) ) (<= (init (cell ?x ?y b)) (even ?x) (odd ?y) ) (init (points misterx 0)) (init (points mistery 0)) (init (control mistery)) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Markierungen ;;; (<= (next (cell ?x ?y f)) (does ?r (mark ?x ?y)) (true (cell ?x ?y b)) ) (<= (next (cell ?x ?y f)) (true (cell ?x ?y f)) ) (<= (next (cell ?x ?y b)) (does ?r (mark ?i ?j)) (true (cell ?x ?y b)) (or (distinct ?x ?i) (distinct ?y ?j) ) ) ;;; Hat ein Spieler gepunktet? ;;; (<= (justBoxed ?r) (true (control ?r)) (newBox ?x ?y) ) ;;; Punkte werden vergeben ;;; (<= (next (points ?r ?y)) (true (control ?r)) (true (points ?r ?x)) (oneNewBox) (succ ?x ?y) ) (<= (next (points ?r ?z)) (true (control ?r)) (true (points ?r ?x)) (twoNewBoxes) (succ ?x ?y) (succ ?y ?z) ) ;;; alte Punkte bleiben erhalten ;;; (<= (next (points ?r ?n)) (true (control ?r)) (true (points ?r ?n)) (not (oneNewBox)) (not (twoNewBoxes)) ) (<= (next (points ?r ?n)) (true (points ?r ?n)) (not (true (control ?r))) ) ;;; entsteht eine neue Box? ;;; (<= (newBox ?x ?y) (oneLeft ?x ?y ?a ?b) (does ?r (mark ?a ?b)) ) ;;; entsteht genau eine neue Box? ;;; (<= (oneNewBox) (newBox ?x ?y) (not twoNewBoxes) ) ;;; entstehen zwei neue Boxen? ;;; (<= (twoNewBoxes) (newBox ?x ?y) (newBox ?i ?j) (or (distinct ?x ?i) (distinct ?y ?j) ) ) ;;; Eine Box wird existieren, wenn sie entweder schon da ist, ;;; oder nur noch ein Strich fehlt, welcher dann auch gesetzt wird (<= (next (box ?x ?y)) (true (box ?x ?y))) (<= (next (box ?x ?y)) (oneLeft ?x ?y ?a ?b) (does ?r (mark ?a ?b)) ) (<= (oneLeft ?bx ?by ?px ?by) (even ?bx) (even ?by) (succ ?px ?bx) (succ ?bx ?nx) (succ ?py ?by) (succ ?by ?ny) (true (cell ?px ?by b)) (true (cell ?nx ?by f)) (true (cell ?bx ?py f)) (true (cell ?bx ?ny f)) ) (<= (oneLeft ?bx ?by ?nx ?by) (even ?bx) (even ?by) (succ ?px ?bx) (succ ?bx ?nx) (succ ?py ?by) (succ ?by ?ny) (true (cell ?px ?by f)) (true (cell ?nx ?by b)) (true (cell ?bx ?py f)) (true (cell ?bx ?ny f)) ) (<= (oneLeft ?bx ?by ?bx ?py) (even ?bx) (even ?by) (succ ?px ?bx) (succ ?bx ?nx) (succ ?py ?by) (succ ?by ?ny) (true (cell ?px ?by f)) (true (cell ?nx ?by f)) (true (cell ?bx ?py b)) (true (cell ?bx ?ny f)) ) (<= (oneLeft ?bx ?by ?bx ?ny) (even ?bx) (even ?by) (succ ?px ?bx) (succ ?bx ?nx) (succ ?py ?by) (succ ?by ?ny) (true (cell ?px ?by f)) (true (cell ?nx ?by f)) (true (cell ?bx ?py f)) (true (cell ?bx ?ny b)) ) ;;; Wer wird den naechsten Zug machen? ;;; Wer gerade einen Punkt bekam, darf nochmal ziehen (<= (next (control misterx)) (true (control mistery)) (not (justBoxed mistery)) ) (<= (next (control mistery)) (true (control misterx)) (not (justBoxed misterx)) ) (<= (next (control ?r)) (justBoxed ?r) ) ;;;;;;;;; Legal Moves ;;;;; (<= (legal ?r (mark ?x ?y)) (true (cell ?x ?y b)) (true (control ?r)) ) (<= (legal misterx noop) (true (control mistery)) ) (<= (legal mistery noop) (true (control misterx)) ) ;;;;;;;;; Goals ;;;;;;;;;;; (<= (goal ?r 100) (true (points ?r 4))) (<= (goal ?r 75) (true (points ?r 3))) (<= (goal ?r 50) (true (points ?r 2))) (<= (goal ?r 25) (true (points ?r 1))) (<= (goal ?r 0) (true (points ?r 0))) ;;;;;;;; Terminal ;;;;;;;;; (<= terminal (not open) ) (<= open (true (cell ?x ?y b)) ) (succ 0 1) (succ 1 2) (succ 2 3) (succ 3 4) (succ 4 5) (even 2) (even 4) (odd 1) (odd 3) (odd 5)