X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=variants%2FSuction%2Fclass.js;h=889a37ff1d0e9541f7d1e2563b4b0aca6af65788;hp=cf5ae1682b74f56431b25632926c3b4b8bfaf421;hb=f31de5e46015a93dca20765da61670035ce8f491;hpb=006c778a7d68e01f635d3d8faa74284512842356 diff --git a/variants/Suction/class.js b/variants/Suction/class.js index cf5ae16..889a37f 100644 --- a/variants/Suction/class.js +++ b/variants/Suction/class.js @@ -41,22 +41,19 @@ export default class SuctionRules extends ChessRules { } } - genRandInitFen(seed) { + genRandInitBaseFen() { const options = Object.assign({mode: "suicide"}, this.options); const gr = new GiveawayRules({options: options, genFenOnly: true}); - const baseFen = gr.genRandInitFen(seed); - // Add empty cmove: - const fenParts = baseFen.split(" "); - let others = JSON.parse(fenParts[3]); - others["cmove"] = "-"; - return fenParts.slice(0, 3).join(" ") + " " + JSON.stringify(others); + 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]) {