X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FWildebeest.js;h=bf5c178b90fdc149300ac8db53ed8927a623504e;hb=3a2a7b5fd3c6bfd0752838094c27e1fb6172d109;hp=fa89cb2170285d316031f056df2170c0f30cc6b4;hpb=a97bdbda4ecf83645d409b717e36828784d1450d;p=vchess.git diff --git a/client/src/variants/Wildebeest.js b/client/src/variants/Wildebeest.js index fa89cb21..bf5c178b 100644 --- a/client/src/variants/Wildebeest.js +++ b/client/src/variants/Wildebeest.js @@ -244,9 +244,20 @@ export const VariantRules = class WildebeestRules extends ChessRules { return 2; } - static GenRandInitFen() { + static GenRandInitFen(randomness) { + if (!randomness) randomness = 2; + if (randomness == 0) + return "rnccwkqbbnr/ppppppppppp/11/11/11/11/11/11/PPPPPPPPPPP/RNBBQKWCCNR w 0 akak -"; + let pieces = { w: new Array(10), b: new Array(10) }; + let flags = ""; for (let c of ["w", "b"]) { + if (c == 'b' && randomness == 1) { + pieces['b'] = pieces['w']; + flags += flags; + break; + } + let positions = ArrayFun.range(11); // Get random squares for bishops + camels (different colors) @@ -264,7 +275,7 @@ export const VariantRules = class WildebeestRules extends ChessRules { for (let idx of randIndexes.concat(randIndexes_tmp).sort((a, b) => { return b - a; })) { - //largest indices first + // Largest indices first positions.splice(idx, 1); } @@ -299,12 +310,13 @@ export const VariantRules = class WildebeestRules extends ChessRules { pieces[c][bishop2Pos] = "b"; pieces[c][knight2Pos] = "n"; pieces[c][rook2Pos] = "r"; + flags += V.CoordToColumn(rook1Pos) + V.CoordToColumn(rook2Pos); } return ( pieces["b"].join("") + "/ppppppppppp/11/11/11/11/11/11/PPPPPPPPPPP/" + pieces["w"].join("").toUpperCase() + - " w 0 1111 -" + " w 0 " + flags + " -" ); } };