projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix options in preset challenges
[vchess.git]
/
client
/
src
/
variants
/
Cwda.js
diff --git
a/client/src/variants/Cwda.js
b/client/src/variants/Cwda.js
index
9142d46
..
2865d1f
100644
(file)
--- a/
client/src/variants/Cwda.js
+++ b/
client/src/variants/Cwda.js
@@
-112,8
+112,7
@@
export class CwdaRules extends ChessRules {
static IsGoodFen(fen) {
if (!ChessRules.IsGoodFen(fen)) return false;
const armies = V.ParseFen(fen).armies;
static IsGoodFen(fen) {
if (!ChessRules.IsGoodFen(fen)) return false;
const armies = V.ParseFen(fen).armies;
- if (!armies || !armies.match(/^[CNRF]{2,2}$/)) return false;
- return true;
+ return (!!armies && armies.match(/^[CNRF]{2,2}$/));
}
getFen() {
}
getFen() {
@@
-304,13
+303,9
@@
export class CwdaRules extends ChessRules {
}
getPotentialN_knightMoves(sq) {
}
getPotentialN_knightMoves(sq) {
- const backward = (this.turn == 'w' ? 1 : -1);
- const kingSteps = [
- [0, -1], [0, 1], [backward, -1], [backward, 0], [backward, 1]
- ];
return (
this.getSlideNJumpMoves(sq, V.steps.$n, 1).concat(
return (
this.getSlideNJumpMoves(sq, V.steps.$n, 1).concat(
- this.getSlideNJumpMoves(sq,
kingSteps
, 1))
+ this.getSlideNJumpMoves(sq,
V.steps.f
, 1))
);
}
);
}
@@
-445,13
+440,9
@@
export class CwdaRules extends ChessRules {
}
isAttackedByN_knight(sq, color) {
}
isAttackedByN_knight(sq, color) {
- const backward = (color == 'w' ? -1 : 1);
- const kingSteps = [
- [0, -1], [0, 1], [backward, -1], [backward, 0], [backward, 1]
- ];
return (
return (
- this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT, V.steps.$n) ||
- this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT,
kingSteps
, 1)
+ this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT, V.steps.$n
, 1
) ||
+ this.isAttackedBySlideNJump(sq, color, V.N_KNIGHT,
V.steps.f
, 1)
);
}
);
}