X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FHidden.js;h=5ccc3d7ed3a9afc0d608a78f9ebd306a23a0a99a;hb=7ba4a5bc5b64e19a1e7f26aa232d5c50770d07ad;hp=96822b937e84990d667b6822c61b6feb098181b0;hpb=71ef1664983cd58db3c3bbfdf6cb7c362474e9a5;p=vchess.git diff --git a/client/src/variants/Hidden.js b/client/src/variants/Hidden.js index 96822b93..5ccc3d7e 100644 --- a/client/src/variants/Hidden.js +++ b/client/src/variants/Hidden.js @@ -61,6 +61,18 @@ export const VariantRules = class HiddenRules extends ChessRules { return piece; } + getPpath(b, color, score) { + if (Object.keys(V.HIDDEN_DECODE).includes(b[1])) { + // Supposed to be hidden. + if (score == "*" && (!color || color != b[0])) + return "Hidden/" + b[0] + "p"; + // Else: condition OK to show the piece + return b[0] + V.HIDDEN_DECODE[b[1]]; + } + // The piece is already not supposed to be hidden: + return b; + } + // Scan board for kings positions (no castling) scanKingsRooks(fen) { this.kingPos = { w: [-1, -1], b: [-1, -1] }; @@ -87,18 +99,6 @@ export const VariantRules = class HiddenRules extends ChessRules { } } - getPpath(b, color, score) { - if (Object.keys(V.HIDDEN_DECODE).includes(b[1])) { - // Supposed to be hidden. - if (score == "*" && (!color || color != b[0])) - return "Hidden/" + b[0] + "p"; - // Else: condition OK to show the piece - return b[0] + V.HIDDEN_DECODE[b[1]]; - } - // The piece is already not supposed to be hidden: - return b; - } - getBasicMove([sx, sy], [ex, ey], tr) { if ( tr && @@ -157,6 +157,7 @@ export const VariantRules = class HiddenRules extends ChessRules { return moves; } + // Ignore randomness here: placement is always random asymmetric static GenRandInitFen() { let pieces = { w: new Array(8), b: new Array(8) }; // Shuffle pieces + pawns on two first ranks