X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FZen.js;h=0675fbc94973940143447c6ca406b396f66bb56c;hb=69f3d8014e594ef949792d04d97b8286e9c2c268;hp=da4dd7af60454924f155a175ed5134c194220c37;hpb=2d7194bd9c976f444e43e5dc0a725823b6472eb9;p=vchess.git diff --git a/public/javascripts/variants/Zen.js b/public/javascripts/variants/Zen.js index da4dd7af..0675fbc9 100644 --- a/public/javascripts/variants/Zen.js +++ b/public/javascripts/variants/Zen.js @@ -1,7 +1,7 @@ class ZenRules extends ChessRules { // NOTE: enPassant, if enabled, would need to redefine carefully getEpSquare - static get HasEnpassant { return false; } + static get HasEnpassant() { return false; } // TODO(?): some duplicated code in 2 next functions getSlideNJumpMoves([x,y], steps, oneStep) @@ -97,7 +97,7 @@ class ZenRules extends ChessRules const firstRank = (color == 'w' ? sizeY-1 : 0); const lastRank = (color == "w" ? 0 : sizeY-1); - if (x+shift >= 0 && x+shift < sizeX && x+shift != lastRank) + if (x+shift != lastRank) { // Normal moves if (this.board[x+shift][y] == V.EMPTY) @@ -111,9 +111,8 @@ class ZenRules extends ChessRules } } - if (x+shift == lastRank) + else //promotion { - // Promotion let promotionPieces = [V.ROOK,V.KNIGHT,V.BISHOP,V.QUEEN]; promotionPieces.forEach(p => { // Normal move @@ -226,3 +225,5 @@ class ZenRules extends ChessRules } } } + +const VariantRules = ZenRules;