From: Benjamin Auder Date: Fri, 3 Jun 2022 12:55:47 +0000 (+0200) Subject: update X-Git-Url: https://git.auder.net/variants/Chakart/css/assets/doc/current/gitweb.css?a=commitdiff_plain;h=f382c57bf08425c170479e55b8670efaf3a7a548;p=xogo.git update --- 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 diff --git a/variants/Chakart/class.js b/variants/Chakart/class.js index ef2ef21..69a2e4c 100644 --- a/variants/Chakart/class.js +++ b/variants/Chakart/class.js @@ -1,6 +1,7 @@ import ChessRules from "/base_rules"; -import { SuicideRules } from "/variants/Suicide"; ////////:TODO generalize genRandInitFen ?! -// constraints satisfaction ? + Chakart display bonus messages +import GiveawayRules from "/variants/Giveaway"; + +// TODO + display bonus messages // + animation + multi-moves for bananas/bombs/mushrooms @@ -1165,11 +1166,12 @@ export class ChakartRules extends ChessRules { return "*"; } - static GenRandInitFen(options) { + genRandInitFen(seed) { + const gr = new GiveawayRules({}, true); return ( - SuicideRules.GenRandInitFen(options).slice(0, -1) + + gr.genRandInitFen(seed).slice(0, -1) + // Add Peach + Mario flags + capture counts - "1111 000000000000" + '{"flags": "1111", "ccount": "000000000000"}' ); }