projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug in sentry attacked detections when pushing lancers
[vchess.git]
/
client
/
src
/
variants
/
Threechecks.js
diff --git
a/client/src/variants/Threechecks.js
b/client/src/variants/Threechecks.js
index
78aaf1f
..
f9fd4d4
100644
(file)
--- a/
client/src/variants/Threechecks.js
+++ b/
client/src/variants/Threechecks.js
@@
-1,6
+1,6
@@
import { ChessRules } from "@/base_rules";
import { ChessRules } from "@/base_rules";
-export c
onst VariantRules = c
lass ThreechecksRules extends ChessRules {
+export class ThreechecksRules extends ChessRules {
static IsGoodFlags(flags) {
// 4 for castle + 2 for checks (0,1 or 2)
return !!flags.match(/^[01]{4,4}[012]{2,2}$/);
static IsGoodFlags(flags) {
// 4 for castle + 2 for checks (0,1 or 2)
return !!flags.match(/^[01]{4,4}[012]{2,2}$/);
@@
-27,13
+27,13
@@
export const VariantRules = class ThreechecksRules extends ChessRules {
getPpath(b) {
// TODO: !!this.checkFlags condition for printDiagram, but clearly not good.
// This is just a temporary fix.
getPpath(b) {
// TODO: !!this.checkFlags condition for printDiagram, but clearly not good.
// This is just a temporary fix.
- if (b[1] == 'k' && this.checkFlags && this.checkFlags[b[0]] > 0)
+ if (b[1] == 'k' &&
!!
this.checkFlags && this.checkFlags[b[0]] > 0)
return "Threechecks/" + b[0] + 'k_' + this.checkFlags[b[0]];
return b;
}
return "Threechecks/" + b[0] + 'k_' + this.checkFlags[b[0]];
return b;
}
-
updateVariables
(move) {
- super.
updateVariables
(move);
+
postPlay
(move) {
+ super.
postPlay
(move);
// Does this move give check?
const oppCol = this.turn;
if (this.underCheck(oppCol))
// Does this move give check?
const oppCol = this.turn;
if (this.underCheck(oppCol))
@@
-47,17
+47,15
@@
export const VariantRules = class ThreechecksRules extends ChessRules {
return super.getCurrentScore();
}
return super.getCurrentScore();
}
- static GenRandInitFen() {
- const randFen = ChessRules.GenRandInitFen();
+ static GenRandInitFen(randomness) {
// Add check flags (at 0)
// Add check flags (at 0)
- return
randFen.replace(" w 0 1111", " w 0 111100")
;
+ return
ChessRules.GenRandInitFen(randomness).slice(0, -2) + "00"
;
}
getFlagsFen() {
let fen = super.getFlagsFen();
// Add check flags
}
getFlagsFen() {
let fen = super.getFlagsFen();
// Add check flags
- for (let c of ["w", "b"])
- fen += this.checkFlags[c];
+ for (let c of ["w", "b"]) fen += this.checkFlags[c];
return fen;
}
return fen;
}