X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FAntiking.js;h=77f0c839e90960b808d2956213e0a815c83bc028;hb=42a9284896b9cf9a579d32b7cf77dfc1f5786472;hp=a13247a1997df63874efe1a12421470b3d6a1964;hpb=6808d7a16ec1e761c6a2dffec2281c96953e4d89;p=vchess.git diff --git a/client/src/variants/Antiking.js b/client/src/variants/Antiking.js index a13247a1..77f0c839 100644 --- a/client/src/variants/Antiking.js +++ b/client/src/variants/Antiking.js @@ -3,10 +3,6 @@ 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"; } @@ -15,6 +11,10 @@ export const VariantRules = class AntikingRules extends ChessRules { return ChessRules.PIECES.concat([V.ANTIKING]); } + getPpath(b) { + return b[1] == "a" ? "Antiking/" + b : b; + } + setOtherVariables(fen) { super.setOtherVariables(fen); this.antikingPos = { w: [-1, -1], b: [-1, -1] }; @@ -131,7 +131,6 @@ export const VariantRules = class AntikingRules extends ChessRules { getCurrentScore() { if (this.atLeastOneMove()) - // game not over return "*"; const color = this.turn; @@ -146,13 +145,25 @@ export const VariantRules = class AntikingRules extends ChessRules { } static get VALUES() { - return Object.assign(ChessRules.VALUES, { a: 1000 }); + return Object.assign( + { a: 1000 }, + ChessRules.VALUES + ); } - static GenRandInitFen() { + static GenRandInitFen(randomness) { + if (randomness == 0) + return "rnbqkbnr/pppppppp/3A4/8/8/3a4/PPPPPPPP/RNBQKBNR w 0 1111 -"; + let pieces = { w: new Array(8), b: new Array(8) }; let antikingPos = { w: -1, b: -1 }; for (let c of ["w", "b"]) { + if (c == 'b' && randomness == 1) { + pieces['b'] = pieces['w']; + antikingPos['b'] = antikingPos['w']; + break; + } + let positions = ArrayFun.range(8); // Get random squares for bishops, but avoid corners; because, @@ -212,4 +223,8 @@ export const VariantRules = class AntikingRules extends ChessRules { " w 0 1111 -" ); } + + static get SEARCH_DEPTH() { + return 2; + } };