X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fbase_rules.js;h=656f7019c5c8f0beac84467b795535e2e2cb7a78;hb=9bd6786b863c31c3ccd0057b87cf454c90886056;hp=350e0de642f59a78536af55c3fab92a3278f0853;hpb=0d329b05fd922645ee52e6709d119a002c8aad64;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 350e0de6..656f7019 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -435,7 +435,7 @@ export const ChessRules = class ChessRules { if (V.HasEnpassant) { const epSq = parsedFen.enpassant != "-" - ? V.SquareToCoords(parsedFen.enpassant) + ? this.getEpSquare(parsedFen.enpassant) : undefined; this.epSquares = [epSq]; } @@ -722,10 +722,11 @@ export const ChessRules = class ChessRules { const oppCol = V.GetOppCol(c); let moves = []; let i = 0; + // King, then rook: const finalSquares = [ [2, 3], [V.size.y - 2, V.size.y - 3] - ]; //king, then rook + ]; castlingCheck: for ( let castleSide = 0; castleSide < 2; @@ -1022,9 +1023,9 @@ export const ChessRules = class ChessRules { play(move) { // DEBUG: - // if (!this.states) this.states = []; - // const stateFen = this.getBaseFen() + this.getTurnFen() + this.getFlagsFen(); - // this.states.push(stateFen); +// if (!this.states) this.states = []; +// const stateFen = this.getBaseFen() + this.getTurnFen() + this.getFlagsFen(); +// this.states.push(stateFen); if (V.HasFlags) move.flags = JSON.stringify(this.aggregateFlags()); //save flags (for undo) if (V.HasEnpassant) this.epSquares.push(this.getEpSquare(move)); @@ -1043,9 +1044,9 @@ export const ChessRules = class ChessRules { this.unupdateVariables(move); // DEBUG: - // const stateFen = this.getBaseFen() + this.getTurnFen() + this.getFlagsFen(); - // if (stateFen != this.states[this.states.length-1]) debugger; - // this.states.pop(); +// const stateFen = this.getBaseFen() + this.getTurnFen() + this.getFlagsFen(); +// if (stateFen != this.states[this.states.length-1]) debugger; +// this.states.pop(); } ///////////////