projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Typo
[vchess.git]
/
client
/
src
/
variants
/
Hamilton.js
diff --git
a/client/src/variants/Hamilton.js
b/client/src/variants/Hamilton.js
index
69dd9e5
..
8738b28
100644
(file)
--- a/
client/src/variants/Hamilton.js
+++ b/
client/src/variants/Hamilton.js
@@
-2,6
+2,11
@@
import { ChessRules, Move, PiPo } from "@/base_rules";
import { randInt } from "@/utils/alea";
export class HamiltonRules extends ChessRules {
import { randInt } from "@/utils/alea";
export class HamiltonRules extends ChessRules {
+
+ static get Options() {
+ return null;
+ }
+
static get HasFlags() {
return false;
}
static get HasFlags() {
return false;
}
@@
-18,10
+23,6
@@
export class HamiltonRules extends ChessRules {
return "xx";
}
return "xx";
}
- hoverHighlight(x, y) {
- return this.movesCount == 0;
- }
-
static board2fen(b) {
if (b[0] == 'x') return 'x';
return ChessRules.board2fen(b);
static board2fen(b) {
if (b[0] == 'x') return 'x';
return ChessRules.board2fen(b);
@@
-68,6
+69,10
@@
export class HamiltonRules extends ChessRules {
return side == this.turn;
}
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;
// Initiate the game by choosing a square for the knight:
doClick(square) {
if (this.movesCount > 0) return null;
@@
-85,13
+90,7
@@
export class HamiltonRules extends ChessRules {
return [...Array(64).keys()].map(k => {
const i = k % 8;
const j = (k - i) / 8;
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++) {
});
}
for (let i=0; i<8; i++) {
@@
-137,6
+136,9
@@
export class HamiltonRules extends ChessRules {
for (let psq of move.appear) board[psq.x][psq.y] = psq.c + psq.p;
}
for (let psq of move.appear) board[psq.x][psq.y] = psq.c + psq.p;
}
+ postPlay() {}
+ postUndo() {}
+
getCheckSquares() {
return [];
}
getCheckSquares() {
return [];
}
@@
-158,4
+160,5
@@
export class HamiltonRules extends ChessRules {
// First game move:
return "N@" + V.CoordsToSquare(move.end);
}
// First game move:
return "N@" + V.CoordsToSquare(move.end);
}
+
};
};