X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FShogi.js;h=e8b179185db972d187407d2e9755b605a55437fe;hb=7e8a7ea1cb66adb4a987badfb0a3c2f99a21bd0a;hp=521e46806310c6a71d183271f9250ab20058e700;hpb=b4f2488a58c5c92e1673cd64c6bba13afcafbf66;p=vchess.git diff --git a/client/src/variants/Shogi.js b/client/src/variants/Shogi.js index 521e4680..e8b17918 100644 --- a/client/src/variants/Shogi.js +++ b/client/src/variants/Shogi.js @@ -3,6 +3,7 @@ import { ArrayFun } from "@/utils/array"; import { sample, shuffle } from "@/utils/alea"; export class ShogiRules extends ChessRules { + static get HasFlags() { return false; } @@ -176,26 +177,27 @@ export class ShogiRules extends ChessRules { setOtherVariables(fen) { super.setOtherVariables(fen); - const fenParsed = V.ParseFen(fen); // Also init reserves (used by the interface to show landable pieces) + const reserve = + V.ParseFen(fen).reserve.split("").map(x => parseInt(x, 10)); this.reserve = { w: { - [V.PAWN]: parseInt(fenParsed.reserve[0]), - [V.ROOK]: parseInt(fenParsed.reserve[1]), - [V.BISHOP]: parseInt(fenParsed.reserve[2]), - [V.GOLD_G]: parseInt(fenParsed.reserve[3]), - [V.SILVER_G]: parseInt(fenParsed.reserve[4]), - [V.KNIGHT]: parseInt(fenParsed.reserve[5]), - [V.LANCE]: parseInt(fenParsed.reserve[6]) + [V.PAWN]: reserve[0], + [V.ROOK]: reserve[1], + [V.BISHOP]: reserve[2], + [V.GOLD_G]: reserve[3], + [V.SILVER_G]: reserve[4], + [V.KNIGHT]: reserve[5], + [V.LANCE]: reserve[6] }, b: { - [V.PAWN]: parseInt(fenParsed.reserve[7]), - [V.ROOK]: parseInt(fenParsed.reserve[8]), - [V.BISHOP]: parseInt(fenParsed.reserve[9]), - [V.GOLD_G]: parseInt(fenParsed.reserve[10]), - [V.SILVER_G]: parseInt(fenParsed.reserve[11]), - [V.KNIGHT]: parseInt(fenParsed.reserve[12]), - [V.LANCE]: parseInt(fenParsed.reserve[13]) + [V.PAWN]: reserve[7], + [V.ROOK]: reserve[8], + [V.BISHOP]: reserve[9], + [V.GOLD_G]: reserve[10], + [V.SILVER_G]: reserve[11], + [V.KNIGHT]: reserve[12], + [V.LANCE]: reserve[13] } }; } @@ -655,4 +657,5 @@ export class ShogiRules extends ChessRules { ) ); } + };