You are not logged in. login register
Game doubletictactoe
name doubletictactoe
creator admin
number of roles 2
stylesheet chess_like/chess_like_automatic_multi.xsl
GDL v1
enabled
matches show matches
statistics show game statistics
description

Game Description

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Tictactoe Rereified
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (role xplayer)
  (role oplayer)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (init (blank a board1))
  (init (blank b board1))
  (init (blank c board1))
  (init (blank d board1))
  (init (blank e board1))
  (init (blank f board1))
  (init (blank g board1))
  (init (blank h board1))
  (init (blank i board1))

  (init (blank a board2))
  (init (blank b board2))
  (init (blank c board2))
  (init (blank d board2))
  (init (blank e board2))
  (init (blank f board2))
  (init (blank g board2))
  (init (blank h board2))
  (init (blank i board2))

  (init (control board1 xplayer))
  (init (control board2 oplayer))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (otherboard board1 board2)
  (otherboard board2 board1)

  (<= (next (ecks ?m ?board))
      (does xplayer (mark ?m ?board))
      (true (blank ?m ?board)))

  (<= (next (oh ?m ?board))
      (does oplayer (mark ?m ?board))
      (true (blank ?m ?board)))

  (<= (next (ecks ?m ?board))
      (true (ecks ?m ?board)))

  (<= (next (oh ?m ?board))
      (true (oh ?m ?board)))

  (<= (next (blank ?m ?board))
      (does ?w (mark ?n ?board))
      (true (blank ?m ?board))
      (distinct ?m ?n))

  (<= (next (blank ?m ?board))
      (true (blank ?m ?board))
      (does ?w noop)
      (true (control ?board ?w)))

  (<= (next (control ?board xplayer))
      (true (control ?board oplayer)))

  (<= (next (control ?board oplayer))
      (true (control ?board xplayer)))

  (line a b c)
  (line a d g)
  (line d e f)
  (line b e h)
  (line g h i)
  (line c f i)
  (line a e i)
  (line c e g)

  (<= (xline ?board)
      (line ?a ?b ?c)
      (true (ecks ?a ?board))
      (true (ecks ?b ?board))
      (true (ecks ?c ?board)))

  (<= (oline ?board)
      (line ?a ?b ?c)
      (true (oh ?a ?board))
      (true (oh ?b ?board))
      (true (oh ?c ?board)))

  (<= (open ?board)
      (true (blank ?m ?board)))
     
  (<= (anyline ?board)
      (xline ?board))

  (<= (anyline ?board)
      (oline ?board))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (<= (legal ?player (mark ?y ?board))
      (true (blank ?y ?board))
      (true (control ?board ?player))
      (not (anyline ?board)))

  (<= (legal ?player noop)
      (true (control ?board ?player))
      (not (open ?board)))

  (<= (legal ?player noop)
      (true (control ?board ?player))
      (anyline ?board))
      
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (<= (goal xplayer 100)
      (xline board1)
      (xline board2))
      
  (<= (goal xplayer 75)
      (xline ?board1)
      (otherboard ?board1 ?board2)
      (not (oline ?board2))
      (not (xline ?board2)))

  (<= (goal xplayer 25)
      (oline ?board1)
      (otherboard ?board1 ?board2)
      (not (oline ?board2))
      (not (xline ?board2)))

  (<= (goal xplayer 0)
      (oline board1)
      (oline board2))
  	  
  (<= (goal ?player 50)
      (role ?player)
      (xline ?board1)
      (otherboard ?board1 ?board2)
      (oline ?board2))

  (<= (goal ?player 50)
      (role ?player)
      (not (open board1))
      (not (open board2))
      (not (anyline board1))
      (not (anyline board2)))

  (<= (goal oplayer 100)
      (oline board1)
      (oline board2))
      
  (<= (goal oplayer 75)
      (oline ?board1)
      (otherboard ?board1 ?board2)
      (not (oline ?board2))
      (not (xline ?board2)))

  (<= (goal oplayer 25)
      (xline ?board1)
      (otherboard ?board1 ?board2)
      (not (oline ?board2))
      (not (xline ?board2)))

  (<= (goal oplayer 0)
      (xline board1)
      (xline board2))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  (<= terminal
      (anyline ?board1)
      (otherboard ?board1 ?board2)
      (anyline ?board2))

  (<= terminal
      (anyline ?board1)
      (otherboard ?board1 ?board2)
      (not (open ?board2)))

  (<= terminal
      (not (open board1))
      (not (open board2)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sees_XML(...) rules

(<= (sees_xml random ?t) (sees_xml1 ?t))
(<= (sees_xml ?p ?t) (role ?p) (distinct ?p random) (sees_xml1 ?t))

; transform the cells such that the normal chess stylesheet understands them
(<= (sees_xml1 (cell1 ?x ?y b))
    (true (blank ?loc board1))
    (loc_to_coords ?loc ?x ?y))
(<= (sees_xml1 (cell2 ?x ?y b))
    (true (blank ?loc board2))
    (loc_to_coords ?loc ?x ?y))
(<= (sees_xml1 (cell1 ?x ?y x))
    (true (ecks ?loc board1))
    (loc_to_coords ?loc ?x ?y))
(<= (sees_xml1 (cell2 ?x ?y x))
    (true (ecks ?loc board2))
    (loc_to_coords ?loc ?x ?y))
(<= (sees_xml1 (cell1 ?x ?y o))
    (true (oh ?loc board1))
    (loc_to_coords ?loc ?x ?y))
(<= (sees_xml1 (cell2 ?x ?y o))
    (true (oh ?loc board2))
    (loc_to_coords ?loc ?x ?y))
(<= (sees_xml1 (control ?p)) (true (control ?p)))

(loc_to_coords a 1 1)
(loc_to_coords b 1 2)
(loc_to_coords c 1 3)
(loc_to_coords d 2 1)
(loc_to_coords e 2 2)
(loc_to_coords f 2 3)
(loc_to_coords g 3 1)
(loc_to_coords h 3 2)
(loc_to_coords i 3 3)