Gamemaster
General
Game
Playing
multiplehunter
Description
Multiplehunter consists of three games of Hunter. Only the middle board matters.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% multiplehunter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(robot) base(cell(B,M,N,P)) :- board(B) & row(M) & col(N) & piece(P) base(captures(M)) :- scoremap(M,N) base(step(B,N)) :- board(B) & succ(M,N) base(control(robot)) action(move(B,X1,Y1,X2,Y2)) :- board(B) & knightmove(X1,Y1,X2,Y2) board(a) board(b) board(c) row(1) row(2) row(3) row(4) row(5) col(1) col(2) col(3) piece(knight) piece(pawn) piece(blank) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(cell(a,1,1,knight)) init(cell(a,1,2,pawn)) init(cell(a,1,3,pawn)) init(cell(a,2,1,pawn)) init(cell(a,2,2,pawn)) init(cell(a,2,3,pawn)) init(cell(a,3,1,pawn)) init(cell(a,3,2,pawn)) init(cell(a,3,3,pawn)) init(cell(a,4,1,pawn)) init(cell(a,4,2,pawn)) init(cell(a,4,3,pawn)) init(cell(a,5,1,pawn)) init(cell(a,5,2,pawn)) init(cell(a,5,3,pawn)) init(cell(b,1,1,knight)) init(cell(b,1,2,pawn)) init(cell(b,1,3,pawn)) init(cell(b,2,1,pawn)) init(cell(b,2,2,pawn)) init(cell(b,2,3,pawn)) init(cell(b,3,1,pawn)) init(cell(b,3,2,pawn)) init(cell(b,3,3,pawn)) init(cell(b,4,1,pawn)) init(cell(b,4,2,pawn)) init(cell(b,4,3,pawn)) init(cell(b,5,1,pawn)) init(cell(b,5,2,pawn)) init(cell(b,5,3,pawn)) init(cell(c,1,1,knight)) init(cell(c,1,2,pawn)) init(cell(c,1,3,pawn)) init(cell(c,2,1,pawn)) init(cell(c,2,2,pawn)) init(cell(c,2,3,pawn)) init(cell(c,3,1,pawn)) init(cell(c,3,2,pawn)) init(cell(c,3,3,pawn)) init(cell(c,4,1,pawn)) init(cell(c,4,2,pawn)) init(cell(c,4,3,pawn)) init(cell(c,5,1,pawn)) init(cell(c,5,2,pawn)) init(cell(c,5,3,pawn)) init(captures(0)) init(step(a,1)) init(step(b,1)) init(step(c,1)) init(control(robot)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(move(B,M1,N1,M2,N2)) :- cell(B,M1,N1,knight) & knightmove(M1,N1,M2,N2) & ~step(B,16) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% move(B,M1,N1,M2,N2) :: ~cell(B,M2,N2,blank) & ~cell(B,M2,N2,pawn) & cell(B,M2,N2,knight) move(B,M1,N1,M2,N2) :: ~cell(B,M1,N1,knight) & cell(B,M1,N1,blank) move(b,M1,N1,M2,N2) :: cell(b,M2,N2,pawn) & captures(Old) & succ(Old,New) ==> ~captures(Old) & captures(New) move(B,M1,N1,M2,N2) :: step(B,Old) & succ(Old,New) ==> ~step(B,Old) & step(B,New) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(robot,Goal) :- captures(Count) & scoremap(Count,Goal) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- step(b,16) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Views %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% knightmove(M1,N1,M2,N2) :- add1row(M1,M2) & add2col(N1,N2) knightmove(M1,N1,M2,N2) :- add1row(M1,M2) & add2col(N2,N1) knightmove(M1,N1,M2,N2) :- add1row(M2,M1) & add2col(N1,N2) knightmove(M1,N1,M2,N2) :- add1row(M2,M1) & add2col(N2,N1) knightmove(M1,N1,M2,N2) :- add2row(M1,M2) & add1col(N1,N2) knightmove(M1,N1,M2,N2) :- add2row(M1,M2) & add1col(N2,N1) knightmove(M1,N1,M2,N2) :- add2row(M2,M1) & add1col(N1,N2) knightmove(M1,N1,M2,N2) :- add2row(M2,M1) & add1col(N2,N1) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Facts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% succ(0,1) 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) succ(13,14) succ(14,15) succ(15,16) add1row(1,2) add1row(2,3) add1row(3,4) add1row(4,5) add2row(1,3) add2row(2,4) add2row(3,5) add1col(1,2) add1col(2,3) add2col(1,3) scoremap(0,0) scoremap(1,1) scoremap(2,3) scoremap(3,7) scoremap(4,11) scoremap(5,16) scoremap(6,22) scoremap(7,29) scoremap(8,37) scoremap(9,45) scoremap(10,54) scoremap(11,64) scoremap(12,75) scoremap(13,87) scoremap(14,100) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//------------------------------------------------------------------------------ // multiplehunter //------------------------------------------------------------------------------ function renderstate (state) {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); var board = renderboard(state); cell.appendChild(board); row = table.insertRow(1); 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','10'); table.setAttribute('cellpadding','0'); table.setAttribute('border','0'); var row = table.insertRow(0); var cell = row.insertCell(0); cell.appendChild(rendergame('a',state)); cell = row.insertCell(1); cell.appendChild(rendergame('b',state)); cell = row.insertCell(2); cell.appendChild(rendergame('c',state)); return table} function rendergame (game,state) {var table = document.createElement('table'); table.setAttribute('cellspacing','0'); table.setAttribute('bgcolor','white'); table.setAttribute('border','10'); makerow(table,game,1,state); makerow(table,game,2,state); makerow(table,game,3,state); makerow(table,game,4,state); makerow(table,game,5,state); return table} function makerow (table,game,rownum,state) {var row =table.insertRow(rownum-1); makecell(row,game,rownum,1,state); makecell(row,game,rownum,2,state); makecell(row,game,rownum,3,state); return row} function makecell (row,game,rownum,colnum,state) {var cell = row.insertCell(colnum-1); cell.setAttribute('width','40'); cell.setAttribute('height','40'); cell.setAttribute('align','center'); cell.setAttribute('valign','center'); rownum = rownum.toString(); colnum = colnum.toString(); var mark = compfindx('Z',seq('cell',game,rownum,colnum,'Z'),state,seq()); if (mark=='knight') {cell.innerHTML = 'K'}; if (mark=='pawn') {cell.innerHTML = 'p'}; if (mark=='blank') {cell.innerHTML = ' '}; return cell} //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Ownership