projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Spartan rules + better moves notation
[vchess.git]
/
client
/
src
/
variants
/
Interweave.js
diff --git
a/client/src/variants/Interweave.js
b/client/src/variants/Interweave.js
index
8e0c3cc
..
1a9cd94
100644
(file)
--- a/
client/src/variants/Interweave.js
+++ b/
client/src/variants/Interweave.js
@@
-3,6
+3,7
@@
import { ArrayFun } from "@/utils/array";
import { randInt, shuffle } from "@/utils/alea";
export class InterweaveRules extends ChessRules {
import { randInt, shuffle } from "@/utils/alea";
export class InterweaveRules extends ChessRules {
+
static get HasFlags() {
return false;
}
static get HasFlags() {
return false;
}
@@
-56,7
+57,7
@@
export class InterweaveRules extends ChessRules {
if (['K','k'].includes(row[i])) kings[row[i]]++;
if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
else {
if (['K','k'].includes(row[i])) kings[row[i]]++;
if (V.PIECES.includes(row[i].toLowerCase())) sumElts++;
else {
- const num = parseInt(row[i]);
+ const num = parseInt(row[i]
, 10
);
if (isNaN(num)) return false;
sumElts += num;
}
if (isNaN(num)) return false;
sumElts += num;
}
@@
-97,18
+98,19
@@
export class InterweaveRules extends ChessRules {
setOtherVariables(fen) {
super.setOtherVariables(fen);
setOtherVariables(fen) {
super.setOtherVariables(fen);
- const fenParsed = V.ParseFen(fen);
+ const captured =
+ V.ParseFen(fen).captured.split("").map(x => parseInt(x, 10));
// Initialize captured pieces' counts from FEN
this.captured = {
w: {
// Initialize captured pieces' counts from FEN
this.captured = {
w: {
- [V.ROOK]:
parseInt(fenParsed.captured[0])
,
- [V.KNIGHT]:
parseInt(fenParsed.captured[1])
,
- [V.BISHOP]:
parseInt(fenParsed.captured[2]),
+ [V.ROOK]:
captured[0]
,
+ [V.KNIGHT]:
captured[1]
,
+ [V.BISHOP]:
captured[2]
},
b: {
},
b: {
- [V.ROOK]:
parseInt(fenParsed.captured[3])
,
- [V.KNIGHT]:
parseInt(fenParsed.captured[4])
,
- [V.BISHOP]:
parseInt(fenParsed.captured[5]),
+ [V.ROOK]:
captured[3]
,
+ [V.KNIGHT]:
captured[4]
,
+ [V.BISHOP]:
captured[5]
}
};
// Stack of "last move" only for intermediate captures
}
};
// Stack of "last move" only for intermediate captures
@@
-638,4
+640,5
@@
export class InterweaveRules extends ChessRules {
if (move.vanish.length >= 2) notation += "X";
return notation;
}
if (move.vanish.length >= 2) notation += "X";
return notation;
}
+
};
};