From: Benjamin Auder Date: Wed, 16 Dec 2020 15:00:52 +0000 (+0100) Subject: Fix Hiddenqueen 'quasi-checkmate' X-Git-Url: https://git.auder.net/images/assets/%7B%7B%20path%28%27fos_user_profile_edit%27%29%20%7D%7D?a=commitdiff_plain;h=be3fb7b5de79dc2295d41b593faf18c6ed895e0d;p=vchess.git Fix Hiddenqueen 'quasi-checkmate' --- diff --git a/TODO b/TODO index 12c7a40c..784a65ff 100644 --- a/TODO +++ b/TODO @@ -8,9 +8,6 @@ On smartphone for Teleport, Chakart, Weiqi and some others: option "confirm move (=> comme pour corr) + option "confirm moves in corr games"? NEW VARIANTS: -Xiangqi -Synochess -EmpireChess Isardam (type B) : https://echekk.fr/spip.php?page=article&id_article=280 https://www.reddit.com/r/TotemChess/comments/imi3v7/totem_rules/ https://www.chessvariants.com/other.dir/fugue.html diff --git a/client/src/variants/Hiddenqueen.js b/client/src/variants/Hiddenqueen.js index 0cf09677..cbe7f929 100644 --- a/client/src/variants/Hiddenqueen.js +++ b/client/src/variants/Hiddenqueen.js @@ -190,8 +190,12 @@ export class HiddenqueenRules extends ChessRules { const color = this.turn; if (this.kingPos[color][0] < 0) // King disappeared - return color == "w" ? "0-1" : "1-0"; - return super.getCurrentScore(); + return (color == "w" ? "0-1" : "1-0"); + const oldSide = this.side; + this.side = color; + const res = super.getCurrentScore(); + this.side = oldSide; + return res; } // Search is biased, so not really needed to explore deeply @@ -213,7 +217,7 @@ export class HiddenqueenRules extends ChessRules { getNotation(move) { // Not using getPiece() method because it would transform HQ into pawn: - if (this.board[move.start.x][move.start.y][1] != V.HIDDEN_QUEEN) + if (this.board[move.start.x][move.start.y].charAt(1) != V.HIDDEN_QUEEN) return super.getNotation(move); const finalSquare = V.CoordsToSquare(move.end); if (move.appear[0].p == V.QUEEN) { diff --git a/server/models/User.js b/server/models/User.js index d62cd767..655012d8 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -2,6 +2,7 @@ const db = require("../utils/database"); const genToken = require("../utils/tokenGenerator"); const params = require("../config/parameters"); const sendEmail = require('../utils/mailer'); +const { exec } = require("child_process"); /* * Structure: