X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHamilton.js;h=856725c1c0a6be9bf7ad690e03b494d62a91907c;hb=e9437f4b2ee9a40013ee514562f39a36d551faab;hp=69dd9e5c7118531ba8f2be5a6b6502ce1e7b18a7;hpb=e50a802531b99829c533f22ecd21e359e7e1e049;p=vchess.git diff --git a/client/src/variants/Hamilton.js b/client/src/variants/Hamilton.js index 69dd9e5c..856725c1 100644 --- a/client/src/variants/Hamilton.js +++ b/client/src/variants/Hamilton.js @@ -2,6 +2,7 @@ import { ChessRules, Move, PiPo } from "@/base_rules"; import { randInt } from "@/utils/alea"; export class HamiltonRules extends ChessRules { + static get HasFlags() { return false; } @@ -18,10 +19,6 @@ export class HamiltonRules extends ChessRules { return "xx"; } - hoverHighlight(x, y) { - return this.movesCount == 0; - } - static board2fen(b) { if (b[0] == 'x') return 'x'; return ChessRules.board2fen(b); @@ -68,6 +65,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; @@ -85,13 +86,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++) { @@ -137,6 +132,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 []; } @@ -158,4 +156,5 @@ export class HamiltonRules extends ChessRules { // First game move: return "N@" + V.CoordsToSquare(move.end); } + };