-export const VariantRules = class CrazyhouseRules extends ChessRules
-{
- static IsGoodFen(fen)
- {
- if (!ChessRules.IsGoodFen(fen))
- return false;
+export class CrazyhouseRules extends ChessRules {
+
+ static get PawnSpecs() {
+ return Object.assign(
+ {},
+ ChessRules.PawnSpecs,
+ // Change names to know that this goes back to pawn after capture:
+ { promotions: ['u', 'o', 'c', 't'] }
+ );
+ }
+
+ static get PIECES() {
+ return ChessRules.PIECES.concat(['u', 'o', 'c', 't']);
+ }
+
+ getPpath(b) {
+ const prefix = (ChessRules.PIECES.includes(b[1]) ? "" : "Crazyhouse/");
+ return prefix + b;
+ }
+
+ static IsGoodFen(fen) {
+ if (!ChessRules.IsGoodFen(fen)) return false;