-class ExtinctionRules extends ChessRules
-{
- setOtherVariables(fen)
- {
- super.setOtherVariables(fen);
- const pos = V.ParseFen(fen).position;
- // NOTE: no need for safety "|| []", because each piece type must be present
- // (otherwise game is already over!)
- this.material =
- {
- "w":
- {
- [V.KING]: pos.match(/K/g).length,
- [V.QUEEN]: pos.match(/Q/g).length,
- [V.ROOK]: pos.match(/R/g).length,
- [V.KNIGHT]: pos.match(/N/g).length,
- [V.BISHOP]: pos.match(/B/g).length,
- [V.PAWN]: pos.match(/P/g).length
- },
- "b":
- {
- [V.KING]: pos.match(/k/g).length,
- [V.QUEEN]: pos.match(/q/g).length,
- [V.ROOK]: pos.match(/r/g).length,
- [V.KNIGHT]: pos.match(/n/g).length,
- [V.BISHOP]: pos.match(/b/g).length,
- [V.PAWN]: pos.match(/p/g).length
- }
- };
- }