Gamemaster
General
Game
Playing
cbnk
Description
Checkers with single jumps played on a barrel, i.e. the board wraps around from top to bottom. No kings. The objective is to take as many of the opponent's pieces as possible. Terminates on step 60 or when all pieces are taken, whichever comes first.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% cbnk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(black) role(red) base(location(X,Y,R)) :- iscell(X,Y) & role(R) base(capturecount(R,0)) :- role(R) base(capturecount(R,N)) :- role(R) & countplus(M,N) base(step(1)) base(step(N)) :- pp(M,N) base(control(R)) :- role(R) action(move(X1,Y1,X2,Y2)) :- iscell(X1,Y1) & redmove(X1,Y1,X2,Y2) action(move(X1,Y1,X2,Y2)) :- iscell(X1,Y1) & blackmove(X1,Y1,X2,Y2) action(jump(X1,Y1,X2,Y2,X3,Y3)) :- iscell(X1,Y1) & redjump(X1,Y1,X2,Y2,X3,Y3) action(jump(X1,Y1,X2,Y2,X3,Y3)) :- iscell(X1,Y1) & blackjump(X1,Y1,X2,Y2,X3,Y3) action(noop) action(capture) action(kerchunk) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(location(1,1,black)) init(location(3,1,black)) init(location(5,1,black)) init(location(7,1,black)) init(location(2,2,black)) init(location(4,2,black)) init(location(6,2,black)) init(location(8,2,black)) init(location(1,3,black)) init(location(3,3,black)) init(location(5,3,black)) init(location(7,3,black)) init(location(2,6,red)) init(location(4,6,red)) init(location(6,6,red)) init(location(8,6,red)) init(location(1,7,red)) init(location(3,7,red)) init(location(5,7,red)) init(location(7,7,red)) init(location(2,8,red)) init(location(4,8,red)) init(location(6,8,red)) init(location(8,8,red)) init(capturecount(black,0)) init(capturecount(red,0)) init(step(1)) init(control(black)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(move(X1,Y1,X2,Y2)) :- control(red) & location(X1,Y1,red) & redmove(X1,Y1,X2,Y2) & cellempty(X2,Y2) legal(move(X1,Y1,X2,Y2)) :- control(black) & location(X1,Y1,black) & blackmove(X1,Y1,X2,Y2) & cellempty(X2,Y2) legal(jump(X1,Y1,X2,Y2,X3,Y3)) :- control(red) & location(X1,Y1,red) & redjump(X1,Y1,X2,Y2,X3,Y3) & location(X2,Y2,black) & cellempty(X3,Y3) legal(jump(X1,Y1,X2,Y2,X3,Y3)) :- control(black) & location(X1,Y1,black) & blackjump(X1,Y1,X2,Y2,X3,Y3) & location(X2,Y2,red) & cellempty(X3,Y3) legal(noop) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% move(X1,Y1,X2,Y2) :: location(X1,Y1,Piece) ==> ~location(X1,Y1,Piece) & location(X2,Y2,Piece) & kerchunk jump(X1,Y1,X2,Y2,X3,Y3) :: location(X1,Y1,Piece) & location(X2,Y2,Other) ==> ~location(X2,Y2,Other) & ~location(X1,Y1,Piece) & location(X3,Y3,Piece) & capture & kerchunk noop :: kerchunk capture :: control(R) & capturecount(R,C1) & countplus(C1,C2) ==> ~capturecount(R,C1) & capturecount(R,C2) kerchunk :: step(S) & pp(S,T) ==> ~step(S) & step(T) kerchunk :: control(red) ==> ~control(red) & control(black) kerchunk :: control(black) ==> ~control(black) & control(red) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(R,Goal) :- capturecount(R,Count) & scoremap(Count,Goal) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- role(Role) & ~haspiece(Role) terminal :- step(41) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Views %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% blackmove(X1,Y1,X2,Y2) :- plusx(1,X1,X2) & plusy(1,Y1,Y2) blackmove(X1,Y1,X2,Y2) :- plusx(1,X2,X1) & plusy(1,Y1,Y2) redmove(X1,Y1,X2,Y2) :- plusx(1,X1,X2) & plusy(1,Y2,Y1) redmove(X1,Y1,X2,Y2) :- plusx(1,X2,X1) & plusy(1,Y2,Y1) blackjump(X1,Y1,X2,Y2,X3,Y3) :- plusx(1,X1,X2) & plusx(1,X2,X3) & plusy(1,Y1,Y2) & plusy(1,Y2,Y3) blackjump(X1,Y1,X2,Y2,X3,Y3) :- plusx(1,X3,X2) & plusx(1,X2,X1) & plusy(1,Y1,Y2) & plusy(1,Y2,Y3) redjump(X1,Y1,X2,Y2,X3,Y3) :- plusx(1,X1,X2) & plusx(1,X2,X3) & plusy(1,Y3,Y2) & plusy(1,Y2,Y1) redjump(X1,Y1,X2,Y2,X3,Y3) :- plusx(1,X3,X2) & plusx(1,X2,X1) & plusy(1,Y3,Y2) & plusy(1,Y2,Y1) haspiece(R) :- location(X,Y,R) cellempty(X,Y) :- iscell(X,Y) & ~location(X,Y,black) & ~location(X,Y,red) iscell(X,Y) :- odd(X) & odd(Y) iscell(X,Y) :- even(X) & even(Y) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Facts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% index(1) index(2) index(3) index(4) index(5) index(6) index(7) index(8) plusx(1,1,2) plusx(1,2,3) plusx(1,3,4) plusx(1,4,5) plusx(1,5,6) plusx(1,6,7) plusx(1,7,8) plusy(1,1,2) plusy(1,2,3) plusy(1,3,4) plusy(1,4,5) plusy(1,5,6) plusy(1,6,7) plusy(1,7,8) plusy(1,8,1) countplus(0,1) countplus(1,2) countplus(2,3) countplus(3,4) countplus(4,5) countplus(5,6) countplus(6,7) countplus(7,8) countplus(8,9) countplus(9,10) countplus(10,11) countplus(11,12) pp(1,2) pp(2,3) pp(3,4) pp(4,5) pp(5,6) pp(6,7) pp(7,8) pp(8,9) pp(9,10) pp(10,11) pp(11,12) pp(12,13) pp(13,14) pp(14,15) pp(15,16) pp(16,17) pp(17,18) pp(18,19) pp(19,20) pp(20,21) pp(21,22) pp(22,23) pp(23,24) pp(24,25) pp(25,26) pp(26,27) pp(27,28) pp(28,29) pp(29,30) pp(30,31) pp(31,32) pp(32,33) pp(33,34) pp(34,35) pp(35,36) pp(36,37) pp(37,38) pp(38,39) pp(39,40) pp(40,41) pp(41,42) pp(42,43) pp(43,44) pp(44,45) pp(45,46) pp(46,47) pp(47,48) pp(48,49) pp(49,50) scoremap(0,0) scoremap(1,8) scoremap(2,16) scoremap(3,24) scoremap(4,32) scoremap(5,40) scoremap(6,48) scoremap(7,56) scoremap(8,64) scoremap(9,72) scoremap(10,80) scoremap(11,90) scoremap(12,100) odd(1) odd(3) odd(5) odd(7) even(2) even(4) even(6) even(8) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//============================================================================== // cbnk //============================================================================== function renderstate (state) {var step = compfindx('N',seq('step','N'),state,library); var role = compfindx('R',seq('control','R'),state,library); var black = compfindx('N',seq('capturecount','black','N'),state,library); var red = compfindx('N',seq('capturecount','red','N'),state,library); var table = document.createElement('table'); table.setAttribute('border','0'); var row = table.insertRow(0); var cell = row.insertCell(0); cell.setAttribute('colspan',3); cell.setAttribute('align','center'); cell.setAttribute('style','font-size:20px'); cell.innerHTML = 'Step: ' + step; row = table.insertRow(1); var cell = row.insertCell(0); cell.setAttribute('align','center'); cell.setAttribute('style','font-size:20px'); cell.innerHTML = "Black:
" + black; cell = row.insertCell(1); cell.appendChild(renderboard(state)); cell = row.insertCell(2); cell.setAttribute('align','center'); cell.setAttribute('style','font-size:20px'); cell.innerHTML = "Red:
" + red; row = table.insertRow(2); var cell = row.insertCell(0); cell.setAttribute('colspan',3); 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','2'); table.setAttribute('bgcolor','#cccccc'); table.setAttribute('border','4'); for (var i=8; i>0; i--) {var row = table.insertRow(8-i); var rank = stringize(i); makecell(row,'1',rank,state); makecell(row,'2',rank,state); makecell(row,'3',rank,state); makecell(row,'4',rank,state); makecell(row,'5',rank,state); makecell(row,'6',rank,state); makecell(row,'7',rank,state); makecell(row,'8',rank,state)}; return table} function makecell (row,file,rank,state) {var cell = row.insertCell(row.cells.length); cell.setAttribute('width','50'); cell.setAttribute('height','50'); cell.setAttribute('align','center'); cell.setAttribute('valign','center'); var image = getimage(file,rank,state); if (image) {var widget = document.createElement('img'); widget.setAttribute('width','40'); widget.setAttribute('height','40'); widget.setAttribute('src',image); cell.appendChild(widget)} else {cell.innerHTML = ' '}; return cell} function getimage (file,rank,state) {var image = compfindx('Piece',seq('location',file,rank,'Piece'),state,library); if (image=='red') {return '../library/cbnk/red.png'}; if (image=='black') {return '../library/cbnk/blue.png'}; return false} //============================================================================== //============================================================================== //==============================================================================
Ownership