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"]) {
//////////////////
// 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
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
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"}'
);
}