X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBaroque.js;h=9b5a3cdb1502336226f95cf4a7992de6fbcf9ad2;hb=0c3fe8a6c3e02af46e0bc646b40c1a0c420f9dcd;hp=c394257a41c99fa31b8ac467351d514f03fc2811;hpb=8d61fc4ab7373b4a576f3f9108cdf7768ae27096;p=vchess.git diff --git a/client/src/variants/Baroque.js b/client/src/variants/Baroque.js index c394257a..9b5a3cdb 100644 --- a/client/src/variants/Baroque.js +++ b/client/src/variants/Baroque.js @@ -1,4 +1,8 @@ -class BaroqueRules extends ChessRules +import { ChessRules, PiPo, Move } from "@/base_rules"; +import { ArrayFun } from "@/utils/array"; +import { randInt } from "@/utils/alea"; + +export const VariantRules = class BaroqueRules extends ChessRules { static get HasFlags() { return false; } @@ -548,34 +552,34 @@ class BaroqueRules extends ChessRules // Shuffle pieces on first and last rank for (let c of ["w","b"]) { - let positions = range(8); + let positions = ArrayFun.range(8); // Get random squares for every piece, totally freely - let randIndex = random(8); + let randIndex = randInt(8); const bishop1Pos = positions[randIndex]; positions.splice(randIndex, 1); - randIndex = random(7); + randIndex = randInt(7); const bishop2Pos = positions[randIndex]; positions.splice(randIndex, 1); - randIndex = random(6); + randIndex = randInt(6); const knight1Pos = positions[randIndex]; positions.splice(randIndex, 1); - randIndex = random(5); + randIndex = randInt(5); const knight2Pos = positions[randIndex]; positions.splice(randIndex, 1); - randIndex = random(4); + randIndex = randInt(4); const queenPos = positions[randIndex]; positions.splice(randIndex, 1); - randIndex = random(3); + randIndex = randInt(3); const kingPos = positions[randIndex]; positions.splice(randIndex, 1); - randIndex = random(2); + randIndex = randInt(2); const rookPos = positions[randIndex]; positions.splice(randIndex, 1); const immobilizerPos = positions[0]; @@ -592,7 +596,7 @@ class BaroqueRules extends ChessRules return pieces["b"].join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" + pieces["w"].join("").toUpperCase() + - " w"; + " w 0"; } getNotation(move)