Gamemaster
General
Game
Playing
simplebuttonsandlights
Description
The overall game consists of nine copies of Buttons and Lights. In each copy of Buttons and Lights, there are three lights and three buttons. Pushing the first button in each group toggles the first light; pushing the second button in each group interchanges the first and second lights; and pushing the third button in each group interchanges the second and third lights. Initially, the lights are all off. The goal is to turn on all of the lights in the fifth group. The settings of the other lights are irrelevant.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goodbuttonsandlights %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(robot) base(p(X)) :- index(X) base(q(X)) :- index(X) base(r(X)) :- index(X) base(step(X,1)) :- index(X) base(step(X,2)) :- index(X) base(step(X,3)) :- index(X) base(step(X,4)) :- index(X) base(step(X,5)) :- index(X) base(step(X,6)) :- index(X) base(step(X,7)) :- index(X) action(a(X)) :- index(X) action(b(X)) :- index(X) action(c(X)) :- index(X) index(1) index(2) index(3) index(4) index(5) index(6) index(7) index(8) index(9) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(step(1,1)) init(step(2,1)) init(step(3,1)) init(step(4,1)) init(step(5,1)) init(step(6,1)) init(step(7,1)) init(step(8,1)) init(step(9,1)) init(control(robot)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(a(5)) :- index(5) & ~step(5,7) legal(b(5)) :- index(5) & ~step(5,7) legal(c(5)) :- index(5) & ~step(5,7) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% a(X) :: ~p(X) ==> p(X) a(X) :: p(X) ==> ~p(X) a(X) :: step(X,M) & successor(M,N) ==> ~step(X,M) & step(X,N) b(X) :: q(X) ==> p(X) b(X) :: ~q(X) ==> ~p(X) b(X) :: p(X) ==> q(X) b(X) :: ~p(X) ==> ~q(X) b(X) :: step(X,M) & successor(M,N) ==> ~step(X,M) & step(X,N) c(X) :: q(X) ==> r(X) c(X) :: ~q(X) ==> ~r(X) c(X) :: r(X) ==> q(X) c(X) :: ~r(X) ==> ~q(X) c(X) :: step(X,M) & successor(M,N) ==> ~step(X,M) & step(X,N) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(robot,100) :- p(5) & q(5) & r(5) goal(robot,50) :- p(5) & q(5) & ~r(5) goal(robot,50) :- p(5) & ~q(5) & r(5) goal(robot,50) :- ~p(5) & q(5) & r(5) goal(robot,25) :- p(5) & ~q(5) & ~r(5) goal(robot,25) :- ~p(5) & q(5) & ~r(5) goal(robot,25) :- p(5) & ~q(5) & ~r(5) goal(robot,0) :- ~p(5) & ~q(5) & ~r(5) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- p(5) & q(5) & r(5) terminal :- step(5,7) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% successor(1,2) successor(2,3) successor(3,4) successor(4,5) successor(5,6) successor(6,7) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//============================================================================== // multiplebuttonsandlights.js //============================================================================== function renderstate (state) {var table = document.createElement('table'); table.setAttribute('cellspacing','0'); table.setAttribute('border','0'); var row = table.insertRow(0); var cell = row.insertCell(0); cell.appendChild(maketable('1',state)); cell = row.insertCell(1); cell.appendChild(maketable('2',state)); cell = row.insertCell(2); cell.appendChild(maketable('3',state)); row = table.insertRow(1); cell = row.insertCell(0); cell.appendChild(maketable('4',state)); cell = row.insertCell(1); cell.appendChild(maketable('5',state)); cell = row.insertCell(2); cell.appendChild(maketable('6',state)); row = table.insertRow(2); cell = row.insertCell(0); cell.appendChild(maketable('7',state)); cell = row.insertCell(1); cell.appendChild(maketable('8',state)); cell = row.insertCell(2); cell.appendChild(maketable('9',state)); return table} function maketable (component,state) {var table = document.createElement('table'); table.setAttribute('cellspacing','0'); table.setAttribute('bgcolor','white'); table.setAttribute('border','4'); makerow(table,0,component,state); return table} function makerow (table,rownum,component,state) {var row =table.insertRow(rownum); makecell(row,seq('p',component),state); makecell(row,seq('q',component),state); makecell(row,seq('r',component),state); return row} function makecell (row,light,state) {var cell = row.insertCell(row.cells.length); cell.setAttribute('width','40'); cell.setAttribute('height','40'); cell.setAttribute('align','center'); cell.setAttribute('valign','center'); if (compfindp(light,state,seq())) {cell.innerHTML = '
'} else {cell.innerHTML = '
'}; return cell} //============================================================================== //============================================================================== //==============================================================================
Ownership