;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Tictactoe (alternate implementation) ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ROLE Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (role xPlayer) (role oPlayer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; INIT Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (init (control xPlayer)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; LEGAL Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (<= (legal xPlayer noop) (true (control oPlayer))) (<= (legal xPlayer (play ?i ?j x)) (true (control xPlayer)) (emptyCell ?i ?j)) (<= (legal oPlayer noop) (true (control xPlayer))) (<= (legal oPlayer (play ?i ?j o)) (true (control oPlayer)) (emptyCell ?i ?j)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; NEXT Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (<= (next (mark ?i ?j ?mark)) (role ?player) (does ?player (play ?i ?j ?mark))) (<= (next (mark ?i ?j ?mark)) (true (mark ?i ?j ?mark))) (<= (next (control xPlayer)) (true (control oPlayer))) (<= (next (control oPlayer)) (true (control xPlayer))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TERMINAL Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (<= terminal (line x)) (<= terminal (line o)) (<= terminal (not open)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GOAL Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (<= (goal xPlayer 100) (line x)) (<= (goal xPlayer 50) (not (line x)) (not (line o)) (not open)) (<= (goal xPlayer 0) (line o)) (<= (goal xPlayer 0) (not (line x)) (not (line o)) open) (<= (goal oPlayer 100) (line o)) (<= (goal oPlayer 50) (not (line x)) (not (line o)) (not open)) (<= (goal oPlayer 0) (line x)) (<= (goal oPlayer 0) (not (line x)) (not (line o)) open) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; View Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (<= (row ?i ?mark) (true (mark ?i 1 ?mark)) (true (mark ?i 2 ?mark)) (true (mark ?i 3 ?mark))) (<= (col ?j ?mark) (true (mark 1 ?j ?mark)) (true (mark 2 ?j ?mark)) (true (mark 3 ?j ?mark))) (<= (diag ?mark) (true (mark 1 1 ?mark)) (true (mark 2 2 ?mark)) (true (mark 3 3 ?mark))) (<= (diag ?mark) (true (mark 1 3 ?mark)) (true (mark 2 2 ?mark)) (true (mark 3 1 ?mark))) (<= (line ?mark) (index ?i) (row ?i ?mark)) (<= (line ?mark) (index ?j) (col ?j ?mark)) (<= (line ?mark) (diag ?mark)) (<= (emptyCell ?i ?j) (index ?i) (index ?j) (not (true (mark ?i ?j x))) (not (true (mark ?i ?j o)))) (<= open (emptyCell ?i ?j)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Static Relations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (index 1) (index 2) (index 3)