X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FLosers.js;h=b4385bab5cbe3ec508928a59af823a929d55763c;hp=81d2730a97976ba3af711a3826d3975d4358b9b4;hb=7ba4a5bc5b64e19a1e7f26aa232d5c50770d07ad;hpb=de520e01c680ca3d74364f73cd29c026b86a883d diff --git a/client/src/variants/Losers.js b/client/src/variants/Losers.js index 81d2730a..b4385bab 100644 --- a/client/src/variants/Losers.js +++ b/client/src/variants/Losers.js @@ -142,10 +142,19 @@ export const VariantRules = class LosersRules extends ChessRules { return -super.evalPosition(); //better with less material } - static GenRandInitFen() { + static GenRandInitFen(randomness) { + if (!randomness) randomness = 2; + if (randomness == 0) + return "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w 0 -"; + let pieces = { w: new Array(8), b: new Array(8) }; // Shuffle pieces on first and last rank for (let c of ["w", "b"]) { + if (c == 'b' && randomness == 1) { + pieces['b'] = pieces['w']; + break; + } + let positions = ArrayFun.range(8); // Get random squares for bishops @@ -194,7 +203,8 @@ export const VariantRules = class LosersRules extends ChessRules { pieces["b"].join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" + pieces["w"].join("").toUpperCase() + + // En-passant allowed, but no flags " w 0 -" - ); //en-passant allowed, but no flags + ); } };