X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAntiking.js;h=610dd2574ddf6249d14d5932410fe73b1c30f713;hb=dac395887d96e2d642b209c6db6aaacc3ffacb34;hp=890da5800e337a480f1cd1d426c66d84e48bdd70;hpb=8d61fc4ab7373b4a576f3f9108cdf7768ae27096;p=vchess.git diff --git a/client/src/variants/Antiking.js b/client/src/variants/Antiking.js index 890da580..610dd257 100644 --- a/client/src/variants/Antiking.js +++ b/client/src/variants/Antiking.js @@ -1,200 +1,207 @@ -class AntikingRules extends ChessRules +import { ChessRules } from "@/base_rules"; +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; - } - - static get ANTIKING() { return 'a'; } - - static get PIECES() - { - return ChessRules.PIECES.concat([V.ANTIKING]); - } - - setOtherVariables(fen) - { - super.setOtherVariables(fen); - 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 + - "/8/8/" + - ranks23_white + "/" + pieces["w"].join("").toUpperCase() + - " w 1111 -"; - } + static getPpath(b) + { + return b[1]=='a' ? "Antiking/"+b : b; + } + + static get ANTIKING() { return 'a'; } + + static get PIECES() + { + return ChessRules.PIECES.concat([V.ANTIKING]); + } + + setOtherVariables(fen) + { + super.setOtherVariables(fen); + 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 + + "/8/8/" + + ranks23_white + "/" + pieces["w"].join("").toUpperCase() + + " w 0 1111 -"; + } }