Attempt to improve scrolling on smartphone
[vchess.git] / client / src / variants / Progressive2.js
CommitLineData
eaab401e
BA
1import { Progressive1Rules } from "@/variants/Progressive1";
2import { SuicideRules } from "@/variants/Suicide";
3import { ChessRules } from "@/base_rules";
4import { randInt } from "@/utils/alea";
5
6export 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
ecb8f91b
BA
20 static get HasEnpassant() {
21 return false;
22 }
23
eaab401e
BA
24 postPlay(move) {
25 const c = move.turn[0];
26 const piece = move.vanish[0].p;
27 if (piece == V.KING && move.appear.length > 0) {
28 this.kingPos[c][0] = move.appear[0].x;
29 this.kingPos[c][1] = move.appear[0].y;
30 }
31 }
32
33 undo(move) {
eaab401e
BA
34 V.UndoOnBoard(this.board, move);
35 if (this.turn != move.turn[0]) this.movesCount--;
36 this.turn = move.turn[0];
37 this.subTurn = move.turn[1];
38 super.postUndo(move);
39 }
40
41 static GenRandInitFen(randomness) {
42 return SuicideRules.GenRandInitFen(randomness);
43 }
44
45 static get VALUES() {
46 return {
47 p: 1,
48 r: 5,
49 n: 3,
50 b: 3,
51 q: 7, //slightly less than in orthodox game
52 k: 1000
53 };
54 }
7e8a7ea1 55
eaab401e 56};