You are not logged in. login register
Game tictactoe_3d_6player
name tictactoe_3d_6player
creator admin
number of roles 6
stylesheet tictactoe_3d/tictactoe_3d.xsl
GDL v1
enabled
matches show matches
statistics show game statistics
description

Game Description

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 6-Player 3D-Tictactoe
;;; by Stephan Schiffel <stephan.schiffel@gmx.de>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Roles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(role xrow)
(role xcolumn)
(role xlevel)
(role orow)
(role ocolumn)
(role olevel)

(role_selects xrow row)
(role_selects orow row)
(role_selects xcolumn column)
(role_selects ocolumn column)
(role_selects xlevel level)
(role_selects olevel level)

(sign xrow x)
(sign xcolumn x)
(sign xlevel x)
(sign orow o)
(sign ocolumn o)
(sign olevel o)

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

(next_role_in_team xrow xcolumn)
(next_role_in_team xcolumn xlevel)
(next_role_in_team xlevel xrow)

(next_role_in_team orow ocolumn)
(next_role_in_team ocolumn olevel)
(next_role_in_team olevel orow)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Initial State
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(<= (init (cell ?x ?y ?z b))
	(coord ?x)
	(coord ?y)
	(coord ?z))

(init (control xrow))

(init (first_role_in_team x xrow))
(init (first_role_in_team o orow))

(coord 1)
(coord 2)
(coord 3)
(coord 4)
  
(succ 1 2)
(succ 2 3)
(succ 3 4)
  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dynamic Components
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Cell

(<= (next (cell ?m ?n ?o ?s))
    (true (cell ?m ?n ?o ?s))
    (not (selected_cell ?m ?n ?o)))

(<= (next (cell ?m ?n ?o ?s))
	(selected_cell ?m ?n ?o)
	(true (control ?p))
	(sign ?p ?s))

;; selected row, column, level

(<= (next (selected ?which ?x))
	(selected_2 ?which ?x)
	(not selected_a_cell))

;; control

(<= (nextplayer ?p1 ?p2)
	selected_a_cell
	(sign ?p1 ?s1)
	(true (first_role_in_team ?s2 ?p2))
	(distinct ?s1 ?s2))
	
(<= (nextplayer ?p1 ?p2)
	(not selected_a_cell)
	(next_role_in_team ?p1 ?p2))

(<= (next (control ?p2))
    (true (control ?p1))
    (nextplayer ?p1 ?p2))

(<= (next (first_role_in_team ?s ?p))
	(not selected_a_cell)
	(true (first_role_in_team ?s ?p)))
	
(<= (next (first_role_in_team ?s ?pold))
	selected_a_cell
	(true (control ?p))
	(true (first_role_in_team ?s ?pold))
	(not (sign ?p ?s)))

(<= (next (first_role_in_team ?s ?pnew))
	selected_a_cell
	(true (control ?p))
	(sign ?p ?s)
	(true (first_role_in_team ?s ?pold))
	(next_role_in_team ?pold ?pnew))

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

(<= (selected_cell ?m ?n ?o)
	(selected_2 row ?m)
	(selected_2 column ?n)
	(selected_2 level ?o))
	
(<= selected_a_cell
	(selected_cell ?m ?n ?o))

(<= (selected_2 ?which ?x)
	(true (selected ?which ?x)))
(<= (selected_2 ?which ?x)
	(does ?p (select ?which ?x)))

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

(<= (line ?s)
	(true (cell ?x1 ?y1 ?z1 ?s))
  	(direction ?xd ?yd ?zd)
  	(next_coord ?xd ?x1 ?x2)
  	(next_coord ?yd ?y1 ?y2)
  	(next_coord ?zd ?z1 ?z2)
  	(true (cell ?x2 ?y2 ?z2 ?s))
  	(next_coord ?xd ?x2 ?x3)
  	(next_coord ?yd ?y2 ?y3)
  	(next_coord ?zd ?z2 ?z3)
  	(true (cell ?x3 ?y3 ?z3 ?s))
  	(next_coord ?xd ?x3 ?x4)
  	(next_coord ?yd ?y3 ?y4)
  	(next_coord ?zd ?z3 ?z4)
  	(true (cell ?x4 ?y4 ?z4 ?s)))

; the 13 different directions for lines in a cube
(direction plus equal equal)   ; x
(direction equal plus equal)   ; y
(direction equal equal plus)   ; z
(direction plus plus equal)    ; xy
(direction plus minus equal)   ; x-y
(direction plus equal plus)    ; xz
(direction plus equal minus)   ; x-z
(direction equal plus plus)    ; yz
(direction equal plus minus)   ; y-z
(direction plus plus plus)    ; xyz
(direction plus plus minus)    ; xy-z
(direction plus minus plus)    ; x-yz
(direction plus minus minus)    ; x-y-z

(<= (next_coord equal ?x ?x)
	(coord ?x))
(<= (next_coord plus ?x1 ?x2)
	(succ ?x1 ?x2))
(<= (next_coord minus ?x1 ?x2)
	(succ ?x2 ?x1))

(<= open
    (true (cell ?x ?y ?z b)))

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

(<= (legal ?p noop)
    (role ?p)
    (not (true (control ?p))))

(<= (legal ?p (select ?which ?m))
	(true (control ?p))
	(role_selects ?p ?which)
	(legal_select_cell ?x ?y ?z)
	(legal_select ?x ?y ?z ?which ?m))


(<= (legal_select ?x ?y ?z row ?x)
	(coord ?x)
	(coord ?y)
	(coord ?z))
(<= (legal_select ?x ?y ?z column ?y)
	(coord ?x)
	(coord ?y)
	(coord ?z))
(<= (legal_select ?x ?y ?z level ?z)
	(coord ?x)
	(coord ?y)
	(coord ?z))

(<= (legal_select_cell ?x ?y ?z)
	(true (cell ?x ?y ?z b))
	(possible row ?x)
	(possible column ?y)
	(possible level ?z))

(<= (possible ?which ?x)
	(true (selected ?which ?x)))

(<= (possible ?which ?x)
	(role_selects ?someone ?which)
	(not (selected_any ?which))
	(coord ?x))

(<= (selected_any ?which)
	(true (selected ?which ?x)))	

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

  (<= (goal ?p 100)
      (sign ?p ?s)
      (line ?s))

  (<= (goal ?p 50)
      (role ?p)
      (not (line x))
      (not (line o)))

  (<= (goal ?p 0)
  	  (sign ?p ?s)
  	  (sign ?p1 ?s1)
  	  (distinct ?s ?s1)
  	  (line ?s1))

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

  (<= terminal
      (sign ?p ?s)
      (line ?s))

  (<= terminal
      (not open))

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

sees_XML(...) rules

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