X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=base_rules.js;h=30e9ee5fc475650d4d13d36b729b9b321e17bbd1;hp=3fa4e0bf40baa5514c40315eb5f21bae97b83c16;hb=f382c57bf08425c170479e55b8670efaf3a7a548;hpb=2b9b90da84838a759b0ca382929bc70b1c83a296 diff --git a/base_rules.js b/base_rules.js index 3fa4e0b..30e9ee5 100644 --- a/base_rules.js +++ b/base_rules.js @@ -184,7 +184,7 @@ export default class ChessRules { else { // Randomize - let pieces = { w: new Array(8), b: new Array(8) }; + let pieces = {w: new Array(8), b: new Array(8)}; flags = ""; // Shuffle pieces on first (and last rank if randomness == 2) for (let c of ["w", "b"]) { @@ -372,13 +372,16 @@ export default class ChessRules { ////////////////// // INITIALIZATION - constructor(o) { + constructor(o, genFenOnly) { this.options = o.options; // Fill missing options (always the case if random challenge) (V.Options.select || []).concat(V.Options.input || []).forEach(opt => { if (this.options[opt.variable] === undefined) this.options[opt.variable] = opt.defaut; }); + if (genFenOnly) + // This object will be used only for initial FEN generation + return; this.playerColor = o.color; this.afterPlay = o.afterPlay; //trigger some actions after playing a move