projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typos
[vchess.git]
/
client
/
src
/
variants
/
Grand.js
diff --git
a/client/src/variants/Grand.js
b/client/src/variants/Grand.js
index
e92896b
..
aeb7b6f
100644
(file)
--- a/
client/src/variants/Grand.js
+++ b/
client/src/variants/Grand.js
@@
-9,20
+9,13
@@
export class GrandRules extends ChessRules {
if (!ChessRules.IsGoodFen(fen)) return false;
const fenParsed = V.ParseFen(fen);
// 5) Check captures
if (!ChessRules.IsGoodFen(fen)) return false;
const fenParsed = V.ParseFen(fen);
// 5) Check captures
- if (!fenParsed.captured || !fenParsed.captured.match(/^[0-9]{1
4,14
}$/))
+ if (!fenParsed.captured || !fenParsed.captured.match(/^[0-9]{1
2,12
}$/))
return false;
return true;
}
static IsGoodEnpassant(enpassant) {
return false;
return true;
}
static IsGoodEnpassant(enpassant) {
- if (enpassant != "-") {
- const squares = enpassant.split(",");
- if (squares.length > 2) return false;
- for (let sq of squares) {
- const ep = V.SquareToCoords(sq);
- if (isNaN(ep.x) || !V.OnBoard(ep)) return false;
- }
- }
+ if (enpassant != "-") return !!enpassant.match(/^([a-j][0-9]{1,2},?)+$/);
return true;
}
return true;
}
@@
-139,7
+132,7
@@
export class GrandRules extends ChessRules {
}
];
if (sx + 2 * step != ex) {
}
];
if (sx + 2 * step != ex) {
- //
3-squares move
+ //
3-squares jump
res.push({
x: sx + 2 * step,
y: sy
res.push({
x: sx + 2 * step,
y: sy
@@
-225,7
+218,7
@@
export class GrandRules extends ChessRules {
// En passant
const Lep = this.epSquares.length;
const epSquare = this.epSquares[Lep - 1];
// En passant
const Lep = this.epSquares.length;
const epSquare = this.epSquares[Lep - 1];
- if (epSquare) {
+ if (
!!
epSquare) {
for (let epsq of epSquare) {
// TODO: some redundant checks
if (epsq.x == x + shiftX && Math.abs(epsq.y - y) == 1) {
for (let epsq of epSquare) {
// TODO: some redundant checks
if (epsq.x == x + shiftX && Math.abs(epsq.y - y) == 1) {