Gamemaster
General
Game
Playing
sukoshi
Description
Sukoshi is 3x3 Sudoku. The player places digits 1, 2, 3 on the board so that no row or column contains more than one occurrence of any digit. The game is over when there are no further legal moves. 100 points for successful completion; 0 points otherwise.
Rulesheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% sukoshi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% metadata %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% role(robot) base(cell(M,N,X)) :- index(M) & index(N) & filler(X) action(mark(M,N,X)) :- index(M) & index(N) & index(X) filler(X) :- index(X) filler(b) index(1) index(2) index(3) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init(cell(1,1,b)) init(cell(1,2,1)) init(cell(1,3,b)) init(cell(2,1,2)) init(cell(2,2,b)) init(cell(2,3,b)) init(cell(3,1,b)) init(cell(3,2,b)) init(cell(3,3,b)) init(control(robot)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% legal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legal(mark(M,N,X)) :- cell(M,N,b) & index(X) & ~row(M,X) & ~col(N,X) row(M,X) :- cell(M,1,X) row(M,X) :- cell(M,2,X) row(M,X) :- cell(M,3,X) col(N,X) :- cell(1,N,X) col(N,X) :- cell(2,N,X) col(N,X) :- cell(3,N,X) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mark(M,N,X) :: ~cell(M,N,b) & cell(M,N,X) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% goal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% goal(robot,100) :- ~open open :- cell(M,N,b) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% terminal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% terminal :- ~playable playable :- legal(mark(M,N,X)) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Stylesheet
//============================================================================== // sukoshi //============================================================================== function renderstate (state) {var table = document.createElement('table'); table.setAttribute('cellspacing','0'); table.setAttribute('border','2'); makerow(table,0,state); makerow(table,1,state); makerow(table,2,state); return table} function makerow (table,rownum,state) {var row =table.insertRow(rownum); makecell(row,rownum,0,state); makecell(row,rownum,1,state); makecell(row,rownum,2,state); return row} function makecell (row,rownum,colnum,state) {var cell = row.insertCell(colnum); cell.setAttribute('width','40'); cell.setAttribute('height','40'); cell.setAttribute('align','center'); cell.setAttribute('valign','center'); cell.setAttribute('style','font-family:helvetica;font-size:18pt'); rownum = (rownum+1).toString(); colnum = (colnum+1).toString(); var mark = compfindx('Z',seq('cell',rownum,colnum,'Z'),state,seq()); if (mark && mark != 'b') {cell.innerHTML = mark} else {cell.innerHTML = ' '}; return cell} //============================================================================== //============================================================================== //==============================================================================
Ownership