X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAntiking.js;h=a13247a1997df63874efe1a12421470b3d6a1964;hp=610dd2574ddf6249d14d5932410fe73b1c30f713;hb=6808d7a16ec1e761c6a2dffec2281c96953e4d89;hpb=ae2c49bb0bbaac3953f63be5b720e9c6835f00b6 diff --git a/client/src/variants/Antiking.js b/client/src/variants/Antiking.js index 610dd257..a13247a1 100644 --- a/client/src/variants/Antiking.js +++ b/client/src/variants/Antiking.js @@ -1,172 +1,168 @@ import { ChessRules } from "@/base_rules"; -import { ArrayFun} from "@/utils/array"; +import { ArrayFun } from "@/utils/array"; import { randInt } from "@/utils/alea"; -export const VariantRules = class AntikingRules extends ChessRules -{ - static getPpath(b) - { - return b[1]=='a' ? "Antiking/"+b : b; +export const VariantRules = class AntikingRules extends ChessRules { + static getPpath(b) { + return b[1] == "a" ? "Antiking/" + b : b; } - static get ANTIKING() { return 'a'; } + static get ANTIKING() { + return "a"; + } - static get PIECES() - { + static get PIECES() { return ChessRules.PIECES.concat([V.ANTIKING]); } - setOtherVariables(fen) - { + setOtherVariables(fen) { super.setOtherVariables(fen); - this.antikingPos = {'w':[-1,-1], 'b':[-1,-1]}; + this.antikingPos = { w: [-1, -1], b: [-1, -1] }; const rows = V.ParseFen(fen).position.split("/"); - for (let i=0; i0?antikingPos["w"]:"") - + "A" + (antikingPos["w"]<7?7-antikingPos["w"]:""); - const ranks23_white = (antikingPos["b"]>0?antikingPos["b"]:"") + "a" - + (antikingPos["b"]<7?7-antikingPos["b"]:"") + "/PPPPPPPP"; - return pieces["b"].join("") + "/" + ranks23_black + + const ranks23_black = + "pppppppp/" + + (antikingPos["w"] > 0 ? antikingPos["w"] : "") + + "A" + + (antikingPos["w"] < 7 ? 7 - antikingPos["w"] : ""); + const ranks23_white = + (antikingPos["b"] > 0 ? antikingPos["b"] : "") + + "a" + + (antikingPos["b"] < 7 ? 7 - antikingPos["b"] : "") + + "/PPPPPPPP"; + return ( + pieces["b"].join("") + + "/" + + ranks23_black + "/8/8/" + - ranks23_white + "/" + pieces["w"].join("").toUpperCase() + - " w 0 1111 -"; + ranks23_white + + "/" + + pieces["w"].join("").toUpperCase() + + " w 0 1111 -" + ); } -} +};