X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FDark.js;h=e1ab30dd6afa42a05b13c82f41b089789e662e97;hb=26b8e4f7c71030d49e44fe1d89632ef91b886d67;hp=96f50de794027e887aa552c5534a94735847f4e9;hpb=5915f72002ae63b04620cebe47adf778174b1bee;p=vchess.git diff --git a/public/javascripts/variants/Dark.js b/public/javascripts/variants/Dark.js index 96f50de7..e1ab30dd 100644 --- a/public/javascripts/variants/Dark.js +++ b/public/javascripts/variants/Dark.js @@ -16,15 +16,37 @@ class DarkRules extends ChessRules updateEnlightened() { - // Initialize with pieces positions (which are seen) for (let i=0; i 0) - { - this.kingPos[c][0] = move.appear[0].x; - this.kingPos[c][1] = move.appear[0].y; - } + super.updateVariables(move); if (move.vanish.length >= 2 && move.vanish[1].p == V.KING) { // We took opponent king ! - const oppCol = this.getOppCol(c); - this.kingPos[oppCol] = [-1,-1]; + this.kingPos[this.turn] = [-1,-1]; } // Update moves for both colors: @@ -98,7 +112,7 @@ class DarkRules extends ChessRules { super.unupdateVariables(move); const c = move.vanish[0].c; - const oppCol = this.getOppCol(c); + const oppCol = V.GetOppCol(c); if (this.kingPos[oppCol][0] < 0) { // Last move took opponent's king @@ -132,7 +146,7 @@ class DarkRules extends ChessRules { const maxeval = V.INFINITY; const color = this.turn; - const oppCol = this.getOppCol(color); + const oppCol = V.GetOppCol(color); const pawnShift = (color == "w" ? -1 : 1); const kp = this.kingPos[color];