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

Game Description

(role player)
(init (step 0))
(init (cell 1 1 nolight))
(init (cell 1 2 nolight))
(init (cell 1 3 light))
(init (cell 1 4 nolight))
(init (cell 1 5 nolight))
(init (cell 2 1 light))
(init (cell 2 2 nolight))
(init (cell 2 3 nolight))
(init (cell 2 4 light))
(init (cell 2 5 light))
(init (cell 3 1 nolight))
(init (cell 3 2 light))
(init (cell 3 3 nolight))
(init (cell 3 4 light))
(init (cell 3 5 nolight))
(init (cell 4 1 nolight))
(init (cell 4 2 nolight))
(init (cell 4 3 light))
(init (cell 4 4 light))
(init (cell 4 5 light))
(init (cell 5 1 nolight))
(init (cell 5 2 nolight))
(init (cell 5 3 light))
(init (cell 5 4 nolight))
(init (cell 5 5 nolight))

(<= (legal player (switch ?x ?y))
	(coord ?x)
	(coord ?y))

(<= (next (cell ?x ?y light))
	(true (cell ?x ?y nolight))
	(affected ?x ?y))
(<= (next (cell ?x ?y nolight))
	(true (cell ?x ?y light))
	(affected ?x ?y))
(<= (next (cell ?x ?y ?state))
	(true (cell ?x ?y ?state))
	(not (affected ?x ?y)))

(<= (next (step ?newstep))
	(true (step ?oldstep))
	(nextstep ?oldstep ?newstep))

(<= terminal (true (step 20)))
(<= terminal (not lighton))

(<= (goal player 100) (not lighton))
(<= (goal player 0) lighton)

(<= lighton
	(coord ?x)
	(coord ?y)
	(true (cell ?x ?y light)))

(<= (affected ?x ?y)
	(does player (switch ?x ?y)))
(<= (affected ?x2 ?y)
	(does player (switch ?x1 ?y))
	(adj ?x1 ?x2))
(<= (affected ?x2 ?y)
	(does player (switch ?x1 ?y))
	(adj ?x2 ?x1))
(<= (affected ?x ?y2)
	(does player (switch ?x ?y1))
	(adj ?y1 ?y2))
(<= (affected ?x ?y2)
	(does player (switch ?x ?y1))
	(adj ?y2 ?y1))

(coord 1) (coord 2) (coord 3) (coord 4) (coord 5)
(adj 1 2) (adj 2 3) (adj 3 4) (adj 4 5)
(nextstep 0 1) (nextstep 1 2) (nextstep 2 3) (nextstep 3 4) (nextstep 4 5) (nextstep 5 6) (nextstep 6 7) (nextstep 7 8) (nextstep 8 9) (nextstep 9 10) (nextstep 10 11) (nextstep 11 12) (nextstep 12 13) (nextstep 13 14) (nextstep 14 15) (nextstep 15 16) (nextstep 16 17) (nextstep 17 18) (nextstep 18 19) (nextstep 19 20)

sees_XML(...) rules

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