Commit | Line | Data |
---|---|---|
c0121280 BA |
1 | import { ChessRules } from "@/base_rules"; |
2 | ||
3 | export class VchessRules extends ChessRules { | |
4 | static get PawnSpecs() { | |
5 | return Object.assign( | |
6 | {}, | |
7 | ChessRules.PawnSpecs, | |
8 | { captureBackward: true } | |
9 | ); | |
10 | } | |
11 | ||
12 | getNotation(move) { | |
13 | let notation = super.getNotation(move); | |
b2b5a729 BA |
14 | // If pawn captures backward, add an indication 'b' |
15 | if ( | |
16 | move.appear[0].p == V.PAWN && | |
17 | ( | |
18 | (move.appear[0].c == 'w' && (move.end.x - move.start.x > 0)) || | |
19 | (move.appear[0].c == 'b' && (move.end.x - move.start.x < 0)) | |
20 | ) | |
21 | ) { | |
22 | notation += 'b'; | |
23 | } | |
c0121280 BA |
24 | return notation; |
25 | } | |
26 | }; |