+ static ParseFen(fen)
+ {
+ const fenParts = fen.split(" ");
+ return Object.assign(
+ ChessRules.ParseFen(fen),
+ { captured: fenParts[4] }
+ );
+ }
+
+ getFen()
+ {
+ return super.getFen() + " " + this.getCapturedFen();
+ }
+
+ getCapturedFen()
+ {
+ let counts = _.map(_.range(10), 0);
+ for (let i=0; i<V.PIECES.length; i++)
+ {
+ counts[i] = this.captured["w"][V.PIECES[i]];
+ counts[5+i] = this.captured["b"][V.PIECES[i]];
+ }
+ return counts.join("");
+ }
+
+ setOtherVariables(fen)
+ {
+ super.setOtherVariables(fen);
+ const fenParsed = V.ParseFen(fen);
+ // Initialize captured pieces' counts from FEN
+ this.captured =
+ {
+ "w":
+ {
+ [V.PAWN]: parseInt(fenParsed.captured[0]),
+ [V.ROOK]: parseInt(fenParsed.captured[1]),
+ [V.KNIGHT]: parseInt(fenParsed.captured[2]),
+ [V.BISHOP]: parseInt(fenParsed.captured[3]),
+ [V.QUEEN]: parseInt(fenParsed.captured[4]),
+ },
+ "b":
+ {
+ [V.PAWN]: parseInt(fenParsed.captured[5]),
+ [V.ROOK]: parseInt(fenParsed.captured[6]),
+ [V.KNIGHT]: parseInt(fenParsed.captured[7]),
+ [V.BISHOP]: parseInt(fenParsed.captured[8]),
+ [V.QUEEN]: parseInt(fenParsed.captured[9]),
+ }
+ };
+ }
+
+ static get size() { return {x:10,y:10}; }