From: Benjamin Auder Date: Wed, 22 Jan 2020 11:33:57 +0000 (+0100) Subject: Some changes to the logic in Rules.vue: weird behavior, TODO X-Git-Url: https://git.auder.net/doc/html/app_dev.php/scripts/current/R.css?a=commitdiff_plain;h=41cb9b940084d6f56351a772f0340ebf0bc8d1bc;p=vchess.git Some changes to the logic in Rules.vue: weird behavior, TODO --- diff --git a/client/src/App.vue b/client/src/App.vue index e06a2fef..84f4b51e 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -22,8 +22,7 @@ | {{ st.tr["Variants"] }} router-link(to="/mygames") | {{ st.tr["My games"] }} - // TODO: parametric URL, "forumURL" - a(href="https://forum.vchess.club") + a(href="https://groups.google.com/forum/#!forum/vchess-club") | {{ st.tr["Forum"] }} #rightMenu .clickable(onClick="doClick('modalUser')") diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 5fb00277..169fb2d9 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -192,7 +192,7 @@ export const ChessRules = class ChessRules // Argument is a move: const move = moveOrSquare; const [sx,sy,ex] = [move.start.x,move.start.y,move.end.x]; - // TODO: next conditions are first for Atomic, and last for Checkered + // NOTE: next conditions are first for Atomic, and last for Checkered if (move.appear.length > 0 && Math.abs(sx - ex) == 2 && move.appear[0].p == V.PAWN && ["w","b"].includes(move.appear[0].c)) { @@ -1128,7 +1128,6 @@ export const ChessRules = class ChessRules // Search depth: 2 for high branching factor, 4 for small (Loser chess, eg.) static get SEARCH_DEPTH() { return 3; } - // Assumption: at least one legal move // NOTE: works also for extinction chess because depth is 3... getComputerMove() { @@ -1137,6 +1136,8 @@ export const ChessRules = class ChessRules // Some variants may show a bigger moves list to the human (Switching), // thus the argument "computer" below (which is generally ignored) let moves1 = this.getAllValidMoves("computer"); + if (moves1.length == 0) //TODO: this situation should not happen + return null; // Can I mate in 1 ? (for Magnetic & Extinction) for (let i of shuffle(ArrayFun.range(moves1.length))) diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index 3b15742d..f10420d7 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -59,6 +59,9 @@ export default { "game.fenStart": function() { this.re_setVariables(); }, + "game.score": function() { + this.score = this.game.score; + }, }, computed: { showMoves: function() { @@ -69,7 +72,7 @@ export default { return this.game.vname != "Dark" || this.score != "*"; }, analyze: function() { - return this.game.mode == "analyze" || this.game.score != "*"; + return this.game.mode == "analyze" || this.score != "*"; }, }, created: function() { diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index f97a2c5a..4da64271 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -370,6 +370,8 @@ export default { .reserve-row-1 margin-bottom: 15px +// NOTE: no variants with reserve of size != 8 + div.board float: left height: 0 @@ -388,8 +390,6 @@ div.board11 width: 9.09% padding-bottom: 9.1% -// NOTE: no variants with reserve of size != 8 - .game width: 80vh margin: 0 auto diff --git a/client/src/components/ComputerGame.vue b/client/src/components/ComputerGame.vue index 9f8e1a30..5b04cd8c 100644 --- a/client/src/components/ComputerGame.vue +++ b/client/src/components/ComputerGame.vue @@ -8,10 +8,10 @@