X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FProgressive2.js;fp=client%2Fsrc%2Fvariants%2FProgressive2.js;h=ffc22bc973589889b63bc0e1c61e3e5d53606c86;hp=0000000000000000000000000000000000000000;hb=eaab401ea14ebbde1e49ede7c639bc3b6556bf08;hpb=0fbe4ffafd65f35ad939134cc89b8bafcc4cd5ca diff --git a/client/src/variants/Progressive2.js b/client/src/variants/Progressive2.js new file mode 100644 index 00000000..ffc22bc9 --- /dev/null +++ b/client/src/variants/Progressive2.js @@ -0,0 +1,51 @@ +import { Progressive1Rules } from "@/variants/Progressive1"; +import { SuicideRules } from "@/variants/Suicide"; +import { ChessRules } from "@/base_rules"; +import { randInt } from "@/utils/alea"; + +export class Progressive2Rules extends Progressive1Rules { + static get PawnSpecs() { + return Object.assign( + {}, + ChessRules.PawnSpecs, + { twoSquares: false } + ); + } + + static get HasFlags() { + return false; + } + + postPlay(move) { + const c = move.turn[0]; + const piece = move.vanish[0].p; + if (piece == V.KING && move.appear.length > 0) { + this.kingPos[c][0] = move.appear[0].x; + this.kingPos[c][1] = move.appear[0].y; + } + } + + undo(move) { + this.disaggregateFlags(JSON.parse(move.flags)); + V.UndoOnBoard(this.board, move); + if (this.turn != move.turn[0]) this.movesCount--; + this.turn = move.turn[0]; + this.subTurn = move.turn[1]; + super.postUndo(move); + } + + static GenRandInitFen(randomness) { + return SuicideRules.GenRandInitFen(randomness); + } + + static get VALUES() { + return { + p: 1, + r: 5, + n: 3, + b: 3, + q: 7, //slightly less than in orthodox game + k: 1000 + }; + } +};