Gamemaster
General
Game
Playing
jealousy
Description
Three husbands (h1, h2, h3) and their wives (w1, w2, w3) want to cross a river. There is a boat that can hold only two people at a time. Any husband, any wife, or any couple (husband and wife) can row the boat. However, there is a catch. The husbands are jealous; no husband wants a situation where his wife is on a river bank with another husband unless he is present as well. To win the game, a player must find a schedule of crossings that gets all three couples across the river by step 12.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% husbandsandwives %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(robot) base(location(X,left)) :- individual(X) base(location(X,right)) :- individual(X) base(boat(left)) base(boat(right)) base(current(M)) :- step(N) base(control(robot)) action(left(X)) :- individual(X) action(right(X)) :- individual(X) action(left(X,Y)) :- spouse(X,Y) action(left(X,Y)) :- husband(X) & husband(Y) & symleq(X,Y) & distinct(X,Y) action(left(X,Y)) :- wife(X) & wife(Y) & symleq(X,Y) & distinct(X,Y) action(right(X,Y)) :- spouse(X,Y) action(right(X,Y)) :- husband(X) & husband(Y) & symleq(X,Y) & distinct(X,Y) action(right(X,Y)) :- wife(X) & wife(Y) & symleq(X,Y) & distinct(X,Y) individual(X) :- husband(X) individual(X) :- wife(X) husband(h1) husband(h2) husband(h3) wife(w1) wife(w2) wife(w3) spouse(h1,w1) spouse(h2,w2) spouse(h3,w3) step(1) step(2) step(3) step(4) step(5) step(6) step(7) step(8) step(9) step(10) step(11) step(12) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(location(h1,left)) init(location(h2,left)) init(location(h3,left)) init(location(w1,left)) init(location(w2,left)) init(location(w3,left)) init(boat(left)) init(current(1)) init(control(robot)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(left(X)) :- boat(right) & location(X,right) legal(right(X)) :- boat(left) & location(X,left) legal(left(X,Y)) :- boat(right) & location(X,right) & location(Y,right) & spouse(X,Y) legal(left(X,Y)) :- boat(right) & location(X,right) & location(Y,right) & husband(X) & husband(Y) & symleq(X,Y) & distinct(X,Y) legal(left(X,Y)) :- boat(right) & location(X,right) & location(Y,right) & wife(X) & wife(Y) & symleq(X,Y) & distinct(X,Y) legal(right(X,Y)) :- boat(left) & location(X,left) & location(Y,left) & spouse(X,Y) legal(right(X,Y)) :- boat(left) & location(X,left) & location(Y,left) & husband(X) & husband(Y) & symleq(X,Y) & distinct(X,Y) legal(right(X,Y)) :- boat(left) & location(X,left) & location(Y,left) & wife(X) & wife(Y) & symleq(X,Y) & distinct(X,Y) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% left(X) :: ~boat(right) & ~location(X,right) & boat(left) & location(X,left) & kerchunk right(X) :: ~boat(left) & ~location(X,left) & boat(right) & location(X,right) & kerchunk left(X,Y) :: ~boat(right) & ~location(X,right) & ~location(Y,right) & boat(left) & location(X,left) & location(Y,left) & kerchunk right(X,Y) :: ~boat(left) & ~location(X,left) & ~location(Y,left) & boat(right) & location(X,right) & location(Y,right) & kerchunk kerchunk :: current(M) & succ(M,N) ==> ~current(M) & current(N) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(robot,Goal) :- countofall(X,location(X,right),N) & scoremap(N,Goal) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- countofall(X,location(X,right),6) terminal :- husband(H1) & location(H1,L) & location(W2,L) & wife(W2) & spouse(H2,W2) & ~location(H2,L) terminal :- current(12) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Views %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% 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) scoremap(0,0) scoremap(1,10) scoremap(2,20) scoremap(3,30) scoremap(4,40) scoremap(5,50) scoremap(6,100) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//------------------------------------------------------------------------------ // Jealousy //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // stylesheet //------------------------------------------------------------------------------ function renderstate (state) {var step = compfindx('N',seq('current','N'),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); return table} function renderboard (state) {var table = document.createElement('table'); table.setAttribute('cellspacing','0'); table.setAttribute('border','1'); var row =table.insertRow(0); var cell = row.insertCell(0); cell.setAttribute('width',50); cell.setAttribute('align','center'); cell.appendChild(makebank('left',state)); var cell = row.insertCell(1); cell.setAttribute('width',100); cell.setAttribute('bgcolor',"#eeeeee"); var cell = row.insertCell(2); cell.setAttribute('width',50); cell.setAttribute('align','center'); cell.appendChild(makebank('right',state)); return table} function makebank (side,state) {var table = document.createElement('table'); var row =table.insertRow(0); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('location','h1',side),state,[])) {cell.innerHTML = 'h1'} else {cell.innerHTML = ' '}; var row =table.insertRow(1); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('location','h2',side),state,[])) {cell.innerHTML = 'h2'} else {cell.innerHTML = ' '}; var row =table.insertRow(2); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('location','h3',side),state,[])) {cell.innerHTML = 'h3'} else {cell.innerHTML = ' '}; var row =table.insertRow(3); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('boat',side),state,[])) {cell.innerHTML = 'boat'} else {cell.innerHTML = ' '}; var row =table.insertRow(4); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('location','w1',side),state,[])) {cell.innerHTML = 'w1'} else {cell.innerHTML = ' '}; var row =table.insertRow(5); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('location','w2',side),state,[])) {cell.innerHTML = 'w2'} else {cell.innerHTML = ' '}; var row =table.insertRow(6); var cell = row.insertCell(0); cell.setAttribute('align','center'); if (compfindp(seq('location','w3',side),state,[])) {cell.innerHTML = 'w3'} else {cell.innerHTML = ' '}; return table} //============================================================================== //============================================================================== //==============================================================================
Ownership