1 import { ChessRules
} from "@/base_rules";
3 // Pawns relayed by one square at a time (but with relaying pioece movements)
4 // diff from https://www.chessvariants.com/rules/relay-chess ==> new name
5 export class RelayupRules
extends ChessRules
{
7 static get PawnSpecs() {
15 static get HasFlags() {
19 static get HasEnpassant() {
23 getPotentialMovesFrom([x
, y
]) {
24 let moves
= super.getPotentialMovesFrom([x
, y
]);
26 // Expand possible moves if guarded by friendly pieces:
27 // --> Pawns cannot be promoted through a relaying move (thus 8th rank forbidden)
34 // Translate final and initial square
35 const initSquare
= V
.CoordsToSquare(move.start
);
36 const finalSquare
= V
.CoordsToSquare(move.end
);
37 const piece
= this.getPiece(move.start
.x
, move.start
.y
);
39 // Since pieces and pawns could move like knight,
40 // indicate start and end squares
44 (move.vanish
.length
> move.appear
.length
? "x" : "") +
49 move.appear
.length
> 0 &&
50 move.appear
[0].p
!= V
.PAWN
53 notation
+= "=" + move.appear
[0].p
.toUpperCase();