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

Game Description

; (yet another) connectfour
; 2007 competition game

(role red)
(role black)
(init (control red))
(<= (legal red noop)
    (true (control black)))
(<= (legal red (drop ?x))
    (true (control red))
    (columnopen ?x))
(<= (legal black noop)
    (true (control red)))
(<= (legal black (drop ?x))
    (true (control black))
    (columnopen ?x))
(<= (next (cell ?x 1 ?player))
    (does ?player (drop ?x))
    (columnempty ?x))
(<= (next (cell ?x ?y2 ?player))
    (does ?player (drop ?x))
    (cellopen ?x ?y2)
    (++ ?y1 ?y2)
    (not (cellopen ?x ?y1)))
(<= (next (cell ?x ?y ?player))
    (true (cell ?x ?y ?player)))
(<= (next (control red))
    (true (control black)))
(<= (next (control black))
    (true (control red)))
(<= terminal
    (line red))
(<= terminal
    (line black))
(<= terminal
    (not boardopen))
(<= (goal red 100)
    (line red))
(<= (goal red 50)
    (not (line red))
    (not (line black))
    (not boardopen))
(<= (goal red 0)
    (line black))
(<= (goal red 0)
    (not (line red))
    (not (line black))
    boardopen)
(<= (goal black 100)
    (line black))
(<= (goal black 50)
    (not (line red))
    (not (line black))
    (not boardopen))
(<= (goal black 0)
    (line red))
(<= (goal black 0)
    (not (line red))
    (not (line black))
    boardopen)
(<= (cellopen ?x ?y)
    (x ?x)
    (y ?y)
    (not (true (cell ?x ?y red)))
    (not (true (cell ?x ?y black))))
(<= (columnopen ?x)
    (cellopen ?x 6))
(<= (columnempty ?x)
    (cellopen ?x 1))
(<= boardopen
    (x ?x)
    (columnopen ?x))
(<= (line ?player)
    (true (cell ?x1 ?y ?player))
    (++ ?x1 ?x2)
    (++ ?x2 ?x3)
    (++ ?x3 ?x4)
    (true (cell ?x2 ?y ?player))
    (true (cell ?x3 ?y ?player))
    (true (cell ?x4 ?y ?player)))
(<= (line ?player)
    (true (cell ?x ?y1 ?player))
    (++ ?y1 ?y2)
    (++ ?y2 ?y3)
    (++ ?y3 ?y4)
    (true (cell ?x ?y2 ?player))
    (true (cell ?x ?y3 ?player))
    (true (cell ?x ?y4 ?player)))
(<= (line ?player)
    (true (cell ?x1 ?y1 ?player))
    (++ ?x1 ?x2)
    (++ ?x2 ?x3)
    (++ ?x3 ?x4)
    (++ ?y1 ?y2)
    (++ ?y2 ?y3)
    (++ ?y3 ?y4)
    (true (cell ?x2 ?y2 ?player))
    (true (cell ?x3 ?y3 ?player))
    (true (cell ?x4 ?y4 ?player)))
(<= (line ?player)
    (true (cell ?x1 ?y4 ?player))
    (++ ?x1 ?x2)
    (++ ?x2 ?x3)
    (++ ?x3 ?x4)
    (++ ?y3 ?y4)
    (++ ?y2 ?y3)
    (++ ?y1 ?y2)
    (true (cell ?x2 ?y3 ?player))
    (true (cell ?x3 ?y2 ?player))
    (true (cell ?x4 ?y1 ?player)))
(++ 1 2)
(++ 2 3)
(++ 3 4)
(++ 4 5)
(++ 5 6)
(++ 6 7)
(++ 7 8)
(x 1)
(x 2)
(x 3)
(x 4)
(x 5)
(x 6)
(x 7)
(x 8)
(y 1)
(y 2)
(y 3)
(y 4)
(y 5)
(y 6)

sees_XML(...) rules

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