Gamemaster
General
Game
Playing
knightthrough
Description
Knightthrough is a game played on an 8x8 rectangular board. White pieces on the bottom two rows of the board and and black pieces on the top two rows of the board. Pieces move like chess knights, except that can only move forward. The winner is the first player to advance one of its pieces to the opposite side of the board.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% knightthrough %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(white) role(black) base(cell(X,Y,R)) :- file(X) & rank(Y) & role(R) base(control(R)) :- role(R) action(move(X1,Y1,X2,Y2)) :- file(X1) & rank(Y1) & whitemove(X1,Y1,X2,Y2) action(move(X1,Y1,X2,Y2)) :- file(X1) & rank(Y1) & blackmove(X1,Y1,X2,Y2) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(cell(a,1,white)) init(cell(b,1,white)) init(cell(c,1,white)) init(cell(d,1,white)) init(cell(e,1,white)) init(cell(f,1,white)) init(cell(g,1,white)) init(cell(h,1,white)) init(cell(a,2,white)) init(cell(b,2,white)) init(cell(c,2,white)) init(cell(d,2,white)) init(cell(e,2,white)) init(cell(f,2,white)) init(cell(g,2,white)) init(cell(h,2,white)) init(cell(a,7,black)) init(cell(b,7,black)) init(cell(c,7,black)) init(cell(d,7,black)) init(cell(e,7,black)) init(cell(f,7,black)) init(cell(g,7,black)) init(cell(h,7,black)) init(cell(a,8,black)) init(cell(b,8,black)) init(cell(c,8,black)) init(cell(d,8,black)) init(cell(e,8,black)) init(cell(f,8,black)) init(cell(g,8,black)) init(cell(h,8,black)) init(control(white)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(move(X1,Y1,X2,Y2)) :- control(white) & cell(X1,Y1,white) & whitemove(X1,Y1,X2,Y2) & ~cell(X2,Y2,white) legal(move(X1,Y1,X2,Y2)) :- control(black) & cell(X1,Y1,black) & blackmove(X1,Y1,X2,Y2) & ~cell(X2,Y2,black) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% move(X1,Y1,X2,Y2) :: control(R) ==> ~cell(X1,Y1,R) & cell(X2,Y2,R) move(X1,Y1,X2,Y2) :: cell(X2,Y2,R) ==> ~cell(X2,Y2,R) move(X1,Y1,X2,Y2) :: control(white) ==> ~control(white) & control(black) move(X1,Y1,X2,Y2) :: control(black) ==> ~control(black) & control(white) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(white,100) :- whitewin goal(white,0) :- blackwin goal(black,100) :- blackwin goal(black,0) :- whitewin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- whitewin terminal :- blackwin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Views %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% whitemove(X1,Y1,X2,Y2) :- skipfile(X1,X2) & nextrank(Y1,Y2) whitemove(X1,Y1,X2,Y2) :- skipfile(X2,X1) & nextrank(Y1,Y2) whitemove(X1,Y1,X2,Y2) :- skiprank(Y1,Y2) & nextfile(X1,X2) whitemove(X1,Y1,X2,Y2) :- skiprank(Y1,Y2) & nextfile(X2,X1) blackmove(X1,Y1,X2,Y2) :- skipfile(X1,X2) & nextrank(Y2,Y1) blackmove(X1,Y1,X2,Y2) :- skipfile(X2,X1) & nextrank(Y2,Y1) blackmove(X1,Y1,X2,Y2) :- skiprank(Y2,Y1) & nextfile(X1,X2) blackmove(X1,Y1,X2,Y2) :- skiprank(Y2,Y1) & nextfile(X2,X1) whitewin :- cell(X,8,white) whitewin :- ~hasanypiece(black) blackwin :- cell(X,1,black) blackwin :- ~hasanypiece(white) hasanypiece(Role) :- cell(X,Y,Role) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Facts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% file(a) file(b) file(c) file(d) file(e) file(f) file(g) file(h) rank(1) rank(2) rank(3) rank(4) rank(5) rank(6) rank(7) rank(8) nextrank(1,2) nextrank(2,3) nextrank(3,4) nextrank(4,5) nextrank(5,6) nextrank(6,7) nextrank(7,8) nextfile(a,b) nextfile(b,c) nextfile(c,d) nextfile(d,e) nextfile(e,f) nextfile(f,g) nextfile(g,h) skiprank(1,3) skiprank(2,4) skiprank(3,5) skiprank(4,6) skiprank(5,7) skiprank(6,8) skipfile(a,c) skipfile(b,d) skipfile(c,e) skipfile(d,f) skipfile(e,g) skipfile(f,h) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//------------------------------------------------------------------------------ // Knightthrough //------------------------------------------------------------------------------ function renderstate (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,'a',rank,state); makecell(row,'b',rank,state); makecell(row,'c',rank,state); makecell(row,'d',rank,state); makecell(row,'e',rank,state); makecell(row,'f',rank,state); makecell(row,'g',rank,state); makecell(row,'h',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('cell',file,rank,'Piece'),state,library); if (image=='white') {return '../library/knightthrough/white.png'}; if (image=='black') {return '../library/knightthrough/black.png'}; return ''} //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Ownership