projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix and complete Apocalypse variant
[vchess.git]
/
client
/
src
/
variants
/
Hidden.js
diff --git
a/client/src/variants/Hidden.js
b/client/src/variants/Hidden.js
index
046fe99
..
2fcab24
100644
(file)
--- a/
client/src/variants/Hidden.js
+++ b/
client/src/variants/Hidden.js
@@
-2,7
+2,7
@@
import { ChessRules, PiPo, Move } from "@/base_rules";
import { ArrayFun } from "@/utils/array";
import { randInt } from "@/utils/alea";
import { ArrayFun } from "@/utils/array";
import { randInt } from "@/utils/alea";
-export c
onst VariantRules = c
lass HiddenRules extends ChessRules {
+export class HiddenRules extends ChessRules {
static get HasFlags() {
return false;
}
static get HasFlags() {
return false;
}
@@
-50,7
+50,7
@@
export const VariantRules = class HiddenRules extends ChessRules {
}
static get PIECES() {
}
static get PIECES() {
- return ChessRules.PIECES.concat(Object.
values(V.HIDDEN_
CODE));
+ return ChessRules.PIECES.concat(Object.
keys(V.HIDDEN_DE
CODE));
}
// Pieces can be hidden :)
}
// Pieces can be hidden :)
@@
-74,7
+74,7
@@
export const VariantRules = class HiddenRules extends ChessRules {
}
// Scan board for kings positions (no castling)
}
// Scan board for kings positions (no castling)
- scanKings
Rooks
(fen) {
+ scanKings(fen) {
this.kingPos = { w: [-1, -1], b: [-1, -1] };
const fenRows = V.ParseFen(fen).position.split("/");
for (let i = 0; i < fenRows.length; i++) {
this.kingPos = { w: [-1, -1], b: [-1, -1] };
const fenRows = V.ParseFen(fen).position.split("/");
for (let i = 0; i < fenRows.length; i++) {
@@
-143,16
+143,6
@@
export const VariantRules = class HiddenRules extends ChessRules {
return mv;
}
return mv;
}
- // What are the king moves from square x,y ?
- getPotentialKingMoves(sq) {
- // No castling:
- return this.getSlideNJumpMoves(
- sq,
- V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
- "oneStep"
- );
- }
-
filterValid(moves) {
return moves;
}
filterValid(moves) {
return moves;
}
@@
-225,8
+215,8
@@
export const VariantRules = class HiddenRules extends ChessRules {
return [];
}
return [];
}
-
updateVariables
(move) {
- super.
updateVariables
(move);
+
postPlay
(move) {
+ super.
postPlay
(move);
if (
move.vanish.length >= 2 &&
[V.KING,V.HIDDEN_CODE[V.KING]].includes(move.vanish[1].p)
if (
move.vanish.length >= 2 &&
[V.KING,V.HIDDEN_CODE[V.KING]].includes(move.vanish[1].p)
@@
-236,8
+226,8
@@
export const VariantRules = class HiddenRules extends ChessRules {
}
}
}
}
-
unupdateVariables
(move) {
- super.
unupdateVariables
(move);
+
postUndo
(move) {
+ super.
postUndo
(move);
const c = move.vanish[0].c;
const oppCol = V.GetOppCol(c);
if (this.kingPos[oppCol][0] < 0)
const c = move.vanish[0].c;
const oppCol = V.GetOppCol(c);
if (this.kingPos[oppCol][0] < 0)