X-Git-Url: https://git.auder.net/assets/current/git-favicon.png?a=blobdiff_plain;f=client%2Fsrc%2Fbase_rules.js;h=da9fab7837622a1dc3fc46ce452da10538d88c66;hb=1cd3e362caa05b60f01cf8b1d4f6bfeafc0be55f;hp=7949d7f605d3856c07db605471d5245bca395481;hpb=241bf8f2a9a2c48d793aeb0b1d20207f6371de70;p=vchess.git diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 7949d7f6..da9fab78 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -46,12 +46,19 @@ export const ChessRules = class ChessRules { static get CanAnalyze() { return true; } + // Patch: issues with javascript OOP, objects can't access static fields. + get canAnalyze() { + return V.CanAnalyze; + } // Some variants show incomplete information, // and thus show only a partial moves list or no list at all. static get ShowMoves() { return "all"; } + get showMoves() { + return V.ShowMoves; + } // Turn "wb" into "B" (for FEN) static board2fen(b) { @@ -357,9 +364,9 @@ export const ChessRules = class ChessRules { for (let indexInRow = 0; indexInRow < rows[i].length; indexInRow++) { const character = rows[i][indexInRow]; const num = parseInt(character); + // If num is a number, just shift j: if (!isNaN(num)) j += num; - //just shift j - //something at position i,j + // Else: something at position i,j else board[i][j++] = V.fen2board(character); } } @@ -1254,7 +1261,7 @@ export const ChessRules = class ChessRules { // TODO: un-ambiguous notation (switch on piece type, check directions...) getNotation(move) { if (move.appear.length == 2 && move.appear[0].p == V.KING) - //castle + // Castle return move.end.y < move.start.y ? "0-0-0" : "0-0"; // Translate final square