From: Benjamin Auder Date: Sun, 27 Dec 2020 09:45:58 +0000 (+0100) Subject: A bit more flexibility in boards drawing X-Git-Url: https://git.auder.net/assets/img/current/pieces/cp.svg?a=commitdiff_plain;h=157a72c805261f68aa1adcd4776debf965d7e6cd;p=vchess.git A bit more flexibility in boards drawing --- diff --git a/TODO b/TODO index cd1d66cc..bb5989e8 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ Implement Wildebeest castle rules => (1, 2, 3 or 4 squares slide; randomized: may be impossible >1, but possible >4...) -Fix Omega squares' color (queen on its color: need new static customization "getSquareColor()") -Finish writing Synochess rules. Embedded rules language not updated when language is set (in Analyse, Game and Problems) If new live game starts in background, "new game" notify OK but not first move (not too serious however) diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 2c2b705c..aa49f91f 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -112,6 +112,11 @@ export const ChessRules = class ChessRules { return false; } + // Some games are drawn unusually (bottomr right corner is black) + static get DarkBottomRight() { + return false; + } + // Some variants require lines drawing static get Lines() { if (V.Monochrome) { diff --git a/client/src/components/Board.vue b/client/src/components/Board.vue index 0430c68f..313564d2 100644 --- a/client/src/components/Board.vue +++ b/client/src/components/Board.vue @@ -171,7 +171,11 @@ export default { }) ); } - const lightSquare = (ci + cj) % 2 == lightSquareMod; + const oddity = (ci + cj) % 2; + const lightSquare = ( + (!V.DarkBottomRight && oddity == lightSquareMod) || + (V.DarkBottomRight && oddity != lightSquareMod) + ); return h( "div", { diff --git a/client/src/utils/printDiagram.js b/client/src/utils/printDiagram.js index 524e12bc..ebc4d114 100644 --- a/client/src/utils/printDiagram.js +++ b/client/src/utils/printDiagram.js @@ -90,8 +90,16 @@ export function getDiagram(args) { (V.Notoodark ? "middle-square" : "dark-square"); if (j == startY) boardDiv += " border-left"; } - else if ((i + j) % 2 == 0) boardDiv += "light-square"; - else boardDiv += "dark-square"; + else { + const oddity = (i + j) % 2; + if ( + (oddity == 0 && !V.DarkBottomRight) || + (oddity == 1 && V.DarkBottomRight) + ) { + boardDiv += "light-square"; + } + else boardDiv += "dark-square"; + } boardDiv += " " + store.state.settings.bcolor; if (shadowArray.length > 0 && shadowArray[i][j]) boardDiv += " in-shadow"; diff --git a/client/src/variants/Omega.js b/client/src/variants/Omega.js index 289c05b3..bac8d50d 100644 --- a/client/src/variants/Omega.js +++ b/client/src/variants/Omega.js @@ -17,6 +17,10 @@ export class OmegaRules extends ChessRules { ); } + static get DarkBottomRight() { + return true; + } + // For space between corners: static get NOTHING() { return "xx";