1 import { ChessRules
, PiPo
, Move
} from "@/base_rules";
3 export class RifleRules
extends ChessRules
{
5 getBasicMove([sx
, sy
], [ex
, ey
], tr
) {
12 if (this.board
[ex
][ey
] != V
.EMPTY
) {
13 // No movement: just vanishing enemy piece
18 c: this.getColor(ex
, ey
),
19 p: this.getPiece(ex
, ey
)
29 c: tr
? tr
.c : this.getColor(sx
, sy
),
30 p: tr
? tr
.p : this.getPiece(sx
, sy
)
37 c: this.getColor(sx
, sy
),
38 p: this.getPiece(sx
, sy
)
46 getEnpassantCaptures([x
, y
], shiftX
) {
48 const Lep
= this.epSquares
.length
;
49 const epSquare
= this.epSquares
[Lep
- 1]; //always at least one element
52 epSquare
.x
== x
+ shiftX
&&
53 Math
.abs(epSquare
.y
- y
) == 1
55 let enpassantMove
= new Move({
59 end: {x:x
+shiftX
, y:epSquare
.y
}
61 enpassantMove
.vanish
.push({
65 c: this.getColor(x
, epSquare
.y
)
67 moves
.push(enpassantMove
);
72 static get SEARCH_DEPTH() {