From: Benjamin Auder Date: Thu, 28 Dec 2023 10:46:58 +0000 (+0100) Subject: Fix complete rules of Cwda X-Git-Url: https://git.auder.net/js/current/app_dev.php/doc/html/packages.html?a=commitdiff_plain;h=2c8375bb77dda7cbeaee983a09e202436be2191c;p=xogo.git Fix complete rules of Cwda --- diff --git a/base_rules.js b/base_rules.js index 699b1d8..757707d 100644 --- a/base_rules.js +++ b/base_rules.js @@ -235,7 +235,7 @@ export default class ChessRules { randomness: this.options["randomness"], between: [{p1: 'k', p2: 'r'}], diffCol: ['b'], - flags: ['r', 'k'] + flags: ['r'] } ); return { @@ -642,7 +642,13 @@ export default class ChessRules { else this[arrName] = ArrayFun.init(this.size.x, this.size.y, null); if (arrName == "d_pieces") - this.marks.forEach(([i, j]) => addPiece(i, j, arrName, "mark")); + this.marks.forEach((m) => { + const formattedSquare = + (this.size.x - parseInt(m.substring(1), 10)).toString(36) + + (m.charCodeAt(0) - 97).toString(36); + const mCoords = V.SquareToCoords(formattedSquare); + addPiece(mCoords.x, mCoords.y, arrName, "mark"); + }); }; if (this.marks) conditionalReset("d_pieces"); diff --git a/common.css b/common.css index cdfbc7a..5fee7ef 100644 --- a/common.css +++ b/common.css @@ -180,6 +180,14 @@ main > div { padding: 0 10px; overflow: auto; } +.full-rules figure.show-pieces { + max-width: 90%; + text-align: center; + margin: 0 auto; +} +.full-rules figure.show-pieces > img { + max-width: 100px; +} .full-rules > div { margin-bottom: 20px; } @@ -234,6 +242,16 @@ piece.mark.transparent { .full-rules .right { float: right; } +@media screen and (max-width: 550px) { + .full-rules .left { + float: none; + margin-bottom: 10px; + } + .full-rules .right { + float: none; + margin-top: 10px; + } +} .full-rules figcaption { display: block; text-align: center; @@ -350,8 +368,6 @@ piece.mark.transparent { .chessboard { position: absolute; cursor: pointer; - min-width: 200px; - min-height: 200px; } piece { position: absolute; diff --git a/utils/drawDiagrams.js b/utils/drawDiagrams.js index 9438dd6..3dd01f6 100644 --- a/utils/drawDiagrams.js +++ b/utils/drawDiagrams.js @@ -11,8 +11,12 @@ function fenToDiag(vname) { function getDiagSize(elt) { const baseWidth = Math.min(window.innerWidth, 800); let multFact = 1; - if (elt.classList.contains("left") || elt.classList.contains("right")) - multFact = 0.45; + if (elt.classList.contains("left") || elt.classList.contains("right")) { + if (baseWidth >= 551) + multFact = 0.45; + else + multFact = 0.7; + } else if (baseWidth > 630) multFact = 0.5; else @@ -43,7 +47,7 @@ function re_drawDiagrams() { element: "diag_" + i, fen: diagrams[i].dataset.fen, marks: diagrams[i].dataset.mks - ? JSON.parse('[' + diagrams[i].dataset.mks + ']') + ? diagrams[i].dataset.mks.split(',') : undefined, color: diagrams[i].dataset.col || 'w', options: {}, diff --git a/variants/Cwda/class.js b/variants/Cwda/class.js index 3a47146..db79917 100644 --- a/variants/Cwda/class.js +++ b/variants/Cwda/class.js @@ -73,7 +73,7 @@ export default class CwdaRules extends ChessRules { randomness: this.options["randomness"], between: [{p1: 'k', p2: 'r'}], diffCol: ['b'], - flags: ['r', 'k'] + flags: ['r'] } ); let pawnLines = { diff --git a/variants/Cwda/complete_rules.html b/variants/Cwda/complete_rules.html index 958c0b6..9114c05 100644 --- a/variants/Cwda/complete_rules.html +++ b/variants/Cwda/complete_rules.html @@ -30,7 +30,7 @@

The Colorbound Clobberers

-
+