Gamemaster
General
Game
Playing
parallelbuttonsandlights
Description
Parallelbuttonsandlights is 2-player version of buttonsandlights. Each player gets to toggle one of three buttons in an attempt to turn on all three of the lights on his own three lights. The game ends after each player has made six moves.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% parallelbuttonsandlights %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(left) role(right) base(p(R)) :- role(R) base(q(R)) :- role(R) base(r(R)) :- role(R) base(played(R)) :- role(R) base(step(1)) base(step(N)) :- succ(M,N) base(control(left)) base(control(right)) action(a(R)) :- role(R) action(b(R)) :- role(R) action(c(R)) :- role(R) action(tick) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(step(1)) init(control(left)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(a(R)) :- control(R) & ~played(R) legal(b(R)) :- control(R) & ~played(R) legal(c(R)) :- control(R) & ~played(R) legal(tick) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% a(R) :: ~p(R) ==> p(R) a(R) :: p(R) ==> ~p(R) a(R) :: played(R) b(R) :: q(R) ==> p(R) b(R) :: ~q(R) ==> ~p(R) b(R) :: p(R) ==> q(R) b(R) :: ~p(R) ==> ~q(R) b(R) :: played(R) c(R) :: q(R) ==> r(R) c(R) :: ~q(R) ==> ~r(R) c(R) :: r(R) ==> q(R) c(R) :: ~r(R) ==> ~q(R) c(R) :: played(R) tick :: ~played(left) & ~played(right) tick :: step(M) & succ(M,N) ==> ~step(M) & step(N) tick :: control(left) ==> ~control(left) & control(right) tick :: control(right) ==> ~control(right) & control(left) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(R,100) :- p(R) & q(R) & r(R) goal(R,50) :- p(R) & q(R) & ~r(R) goal(R,50) :- p(R) & ~q(R) & r(R) goal(R,50) :- ~p(R) & q(R) & r(R) goal(R,25) :- p(R) & ~q(R) & ~r(R) goal(R,25) :- ~p(R) & q(R) & ~r(R) goal(R,25) :- p(R) & ~q(R) & ~r(R) goal(R,0) :- ~p(R) & ~q(R) & ~r(R) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- step(13) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Facts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% succ(1,2) succ(2,3) succ(3,4) succ(4,5) succ(5,6) succ(6,7) succ(7,8) succ(8,9) succ(9,10) succ(10,11) succ(11,12) succ(12,13) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//============================================================================== // parallelbuttonsandlights //============================================================================== function renderstate (state) {var step = compfindx('N',seq('step','N'),state,library); var role = compfindx('R',seq('control','R'),state,library); var table = document.createElement('table'); table.setAttribute('border','0'); var row = table.insertRow(0); var cell = row.insertCell(0); cell.setAttribute('align','center'); cell.setAttribute('style','font-size:20px'); cell.innerHTML = 'Step: ' + step; row = table.insertRow(1); var cell = row.insertCell(0); var board = renderboard(state); cell.appendChild(board); row = table.insertRow(2); var cell = row.insertCell(0); cell.setAttribute('align','center'); cell.setAttribute('style','font-size:20px'); if (compfindp('terminal',state,library)) {cell.innerHTML = 'Game over'} else {cell.innerHTML = 'Control: ' + role}; return table} function renderboard (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('left',state)); cell = row.insertCell(1); cell.appendChild(maketable('right',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