1 class CrazyhouseRules
extends ChessRules
6 // Also init reserves (used by the interface to show landing pieces)
7 const V
= VariantRules
;
27 // It may be a continuation: adjust numbers of pieces according to captures + rebirths
31 // Used by the interface:
32 getReservePieces(color
)
35 [color
+V
.PAWN
]: this.reserve
[color
][V
.PAWN
],
36 [color
+V
.ROOK
]: this.reserve
[color
][V
.ROOK
],
37 [color
+V
.KNIGHT
]: this.reserve
[color
][V
.KNIGHT
],
38 [color
+V
.BISHOP
]: this.reserve
[color
][V
.BISHOP
],
39 [color
+V
.QUEEN
]: this.reserve
[color
][V
.QUEEN
],
43 getPotentialMovesFrom([x
,y
])
45 let moves
= super.getPotentialMovesFrom([x
,y
]);
47 const color
= this.turn
;
48 Object
.keys(this.reserve
[color
]).forEach(p
=> {
50 moves
.push(...); //concat... just appear
55 // TODO: condition "if this is reserve" --> special square !!! coordinates ??
56 getPossibleMovesFrom(sq
)
58 // Assuming color is right (already checked)
59 return this.filterValid( this.getPotentialMovesFrom(sq
) );
62 // TODO: add reserve moves
74 // TODO: update reserve
78 unupdateVariables(move)
82 static get SEARCH_DEPTH() { return 2; } //high branching factor
86 if (move.vanish
.length
> 0)
87 return super.getNotation(move);
90 (move.appear
[0].p
!= VariantRules
.PAWN
? move.appear
.p
.toUpperCase() : "");
92 String
.fromCharCode(97 + move.end
.y
) + (VariantRules
.size
[0]-move.end
.x
);
93 return piece
+ "@" + finalSquare
;