X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHamilton.js;h=8738b2897bc73bd591a7f3ddca8f555cec5a40e7;hb=4313762da3237b04f204e121a20cab3ba7bb5dd2;hp=47af232aafc80b86b673b147d71fcce6822b379e;hpb=7c05a5f2297bea540c700ebceb0cc8b03a7f6775;p=vchess.git diff --git a/client/src/variants/Hamilton.js b/client/src/variants/Hamilton.js index 47af232a..8738b289 100644 --- a/client/src/variants/Hamilton.js +++ b/client/src/variants/Hamilton.js @@ -3,6 +3,10 @@ import { randInt } from "@/utils/alea"; export class HamiltonRules extends ChessRules { + static get Options() { + return null; + } + static get HasFlags() { return false; } @@ -19,10 +23,6 @@ export class HamiltonRules extends ChessRules { return "xx"; } - hoverHighlight() { - return this.movesCount == 0; - } - static board2fen(b) { if (b[0] == 'x') return 'x'; return ChessRules.board2fen(b); @@ -69,6 +69,10 @@ export class HamiltonRules extends ChessRules { return side == this.turn; } + hoverHighlight() { + return this.movesCount == 0; + } + // Initiate the game by choosing a square for the knight: doClick(square) { if (this.movesCount > 0) return null; @@ -86,13 +90,7 @@ export class HamiltonRules extends ChessRules { return [...Array(64).keys()].map(k => { const i = k % 8; const j = (k - i) / 8; - return new Move({ - appear: [ - new PiPo({ x: i, y: j, c: 'w', p: V.KNIGHT }) - ], - vanish: [], - start: { x: -1, y: -1 } - }); + return this.doClick([i, j]); }); } for (let i=0; i<8; i++) { @@ -138,6 +136,9 @@ export class HamiltonRules extends ChessRules { for (let psq of move.appear) board[psq.x][psq.y] = psq.c + psq.p; } + postPlay() {} + postUndo() {} + getCheckSquares() { return []; }