1 import { ChessRules
, PiPo
, Move
} from "@/base_rules";
3 export class RifleRules
extends ChessRules
{
4 getBasicMove([sx
, sy
], [ex
, ey
], tr
) {
11 if (this.board
[ex
][ey
] != V
.EMPTY
) {
12 // No movement: just vanishing enemy piece
17 c: this.getColor(ex
, ey
),
18 p: this.getPiece(ex
, ey
)
28 c: tr
? tr
.c : this.getColor(sx
, sy
),
29 p: tr
? tr
.p : this.getPiece(sx
, sy
)
36 c: this.getColor(sx
, sy
),
37 p: this.getPiece(sx
, sy
)
45 getEnpassantCaptures([x
, y
], shiftX
) {
47 const Lep
= this.epSquares
.length
;
48 const epSquare
= this.epSquares
[Lep
- 1]; //always at least one element
51 epSquare
.x
== x
+ shiftX
&&
52 Math
.abs(epSquare
.y
- y
) == 1
54 let enpassantMove
= new Move({
58 end: {x:x
+shiftX
, y:epSquare
.y
}
60 enpassantMove
.vanish
.push({
64 c: this.getColor(x
, epSquare
.y
)
66 moves
.push(enpassantMove
);
71 static get SEARCH_DEPTH() {