}
}
- genRandInitFen(seed) {
+ genRandInitBaseFen() {
const options = Object.assign({mode: "suicide"}, this.options);
const gr = new GiveawayRules({options: options, genFenOnly: true});
- // Add empty cmove:
- return (
- gr.genRandInitFen(seed).slice(0, -17) + '{"enpassant":"-","cmove":"-"}');
+ return gr.genRandInitBaseFen();
}
- getFen() {
- const cmoveFen = !this.cmove
+ getPartFen(o) {
+ let parts = super.getPartFen(o);
+ const cmoveFen = o.init || !this.cmove
? "-"
: C.CoordsToSquare(this.cmove.start) + C.CoordsToSquare(this.cmove.end);
- return super.getFen().slice(0, -1) + ',"cmove":"' + cmoveFen + '"}';
+ parts["cmove"] = cmoveFen;
+ return parts;
}
getBasicMove([sx, sy], [ex, ey]) {
getCurrentScore() {
const color = this.turn;
const kingPos = super.searchKingPos(color);
- if (color == "w" && kingPos[0] == 0) return "0-1";
- if (color == "b" && kingPos[0] == this.size.x - 1) return "1-0";
+ if (color == "w" && kingPos[0][0] == 0) return "0-1";
+ if (color == "b" && kingPos[0][0] == this.size.x - 1) return "1-0";
// King is not on the opposite edge: game not over
return "*";
}