Commit | Line | Data |
---|---|---|
eaab401e BA |
1 | import { Progressive1Rules } from "@/variants/Progressive1"; |
2 | import { SuicideRules } from "@/variants/Suicide"; | |
3 | import { ChessRules } from "@/base_rules"; | |
4 | import { randInt } from "@/utils/alea"; | |
5 | ||
6 | export class Progressive2Rules extends Progressive1Rules { | |
7e8a7ea1 | 7 | |
eaab401e BA |
8 | static get PawnSpecs() { |
9 | return Object.assign( | |
10 | {}, | |
11 | ChessRules.PawnSpecs, | |
12 | { twoSquares: false } | |
13 | ); | |
14 | } | |
15 | ||
16 | static get HasFlags() { | |
17 | return false; | |
18 | } | |
19 | ||
20 | postPlay(move) { | |
21 | const c = move.turn[0]; | |
22 | const piece = move.vanish[0].p; | |
23 | if (piece == V.KING && move.appear.length > 0) { | |
24 | this.kingPos[c][0] = move.appear[0].x; | |
25 | this.kingPos[c][1] = move.appear[0].y; | |
26 | } | |
27 | } | |
28 | ||
29 | undo(move) { | |
eaab401e BA |
30 | V.UndoOnBoard(this.board, move); |
31 | if (this.turn != move.turn[0]) this.movesCount--; | |
32 | this.turn = move.turn[0]; | |
33 | this.subTurn = move.turn[1]; | |
34 | super.postUndo(move); | |
35 | } | |
36 | ||
37 | static GenRandInitFen(randomness) { | |
38 | return SuicideRules.GenRandInitFen(randomness); | |
39 | } | |
40 | ||
41 | static get VALUES() { | |
42 | return { | |
43 | p: 1, | |
44 | r: 5, | |
45 | n: 3, | |
46 | b: 3, | |
47 | q: 7, //slightly less than in orthodox game | |
48 | k: 1000 | |
49 | }; | |
50 | } | |
7e8a7ea1 | 51 | |
eaab401e | 52 | }; |