From 6701c096c47f2d37031de9c7fa58e4e57bfe93fa Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 30 Jul 2023 19:04:24 +0200 Subject: [PATCH 01/14] WIP --- src-ui/list.html | 1 + src/pzpr/variety.js | 1 + src/variety/kaidan.js | 70 ++++++++++++++++++++++++++++++------------- 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src-ui/list.html b/src-ui/list.html index a44d83b2e..1f35be025 100644 --- a/src-ui/list.html +++ b/src-ui/list.html @@ -329,6 +329,7 @@

パズルの種類のリスト
  • +
  • diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index 9c6cd664a..e5ea4a06f 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -381,6 +381,7 @@ wagiri: [0, 0, "ごきげんななめ・輪切", "Wagiri", "gokigen"], walllogic: [0, 0, "ウォールロジック", "Wall Logic"], wblink: [0, 0, "シロクロリンク", "Shirokuro-link"], + wittgen: [0, 0, "Wittgenstein Briquet", "Wittgenstein Briquet", "kaidan"], yajikazu: [1, 0, "やじさんかずさん", "Yajisan-Kazusan"], yajilin: [ 0, diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index 3fd9c9447..c49af4cba 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -4,7 +4,7 @@ } else { pzpr.classmgr.makeCustom(pidlist, classbase); } -})(["kaidan", "takoyaki"], { +})(["kaidan", "takoyaki", "wittgen"], { MouseEvent: { use: true, RBShadeCell: true, @@ -53,13 +53,19 @@ return; } - if (this.pid === "kaidan" && cell.lcnt === 1 && this.btn === "left") { + if ( + (this.pid === "kaidan" || this.pid === "wittgen") && + cell.lcnt === 1 && + this.btn === "left" + ) { cell.setLineVal(+!cell.line); cell.draw(); } else if (cell.isNum()) { this.inputqcmp(); } else if (this.btn === "right" && this.inputpeke_ifborder()) { return; + } else if (this.pid === "wittgen") { + this.inputBGcolor(); } else { this.inputcell(); } @@ -99,7 +105,7 @@ this.common.mousereset.call(this); } }, - "MouseEvent@kaidan": { + "MouseEvent@kaidan,wittgen": { inputLine: function() { var cell = this.getcell(); var addcmp = false; @@ -172,11 +178,20 @@ } } }, + "MouseEvent@wittgen#2": { + inputModes: { + edit: ["number", "undef", "clear"], + play: ["line", "peke", "bgcolor", "bgcolor1", "bgcolor2", "completion"] + }, + inputShade: function() { + this.inputBGcolor(); + } + }, KeyEvent: { enablemake: true }, - "Border@kaidan": { + "Border@kaidan,wittgen": { prehook: { line: function(num) { return (num && this.isLineNG()) || this.checkFormCurve(num); @@ -262,14 +277,18 @@ this.drawBGCells(); this.drawGrid(); - this.drawQuesCells(); + if (this.pid !== "wittgen") { + this.drawQuesCells(); + } this.drawQuesNumbers(); - this.drawCircles(); - this.drawCrosses(); + if (this.pid !== "wittgen") { + this.drawCircles(); + this.drawCrosses(); + } this.drawLines(); - if (this.pid === "kaidan") { + if (this.pid === "kaidan" || this.pid === "wittgen") { this.drawLineEnds(); } this.drawPekes(); @@ -321,7 +340,7 @@ return null; } }, - "Graphic@kaidan": { + "Graphic@kaidan,wittgen": { drawLines: function() { var g = this.vinc("line", "crispEdges"); var mx = this.bw / 2; @@ -404,6 +423,15 @@ "Graphic@takoyaki": { irowake: true }, + "Graphic@wittgen#2": { + bgcellcolor_func: "qsub2", + getQuesNumberColor: function(cell) { + if ((cell.error || cell.qinfo) === 1) { + return this.errcolor1; + } + return cell.qcmp ? this.qcmpcolor : this.quescolor; + } + }, Encode: { decodePzpr: function(type) { @@ -463,6 +491,16 @@ 1, "nmShadeLt" ); + }, + checkLineOverlap: function() { + this.checkAllCell(function(cell) { + return cell.lcnt > 2 || cell.isLineCurve(); + }, "laCurve"); + }, + checkMissingEnd: function() { + this.checkAllCell(function(cell) { + return cell.lcnt === 1 && !cell.line; + }, "ceNoEnd"); } }, @@ -514,17 +552,6 @@ return b1.line && b2.line; }, "lnEnds"); }, - - checkLineOverlap: function() { - this.checkAllCell(function(cell) { - return cell.lcnt > 2 || cell.isLineCurve(); - }, "laCurve"); - }, - checkMissingEnd: function() { - this.checkAllCell(function(cell) { - return cell.lcnt === 1 && !cell.line; - }, "ceNoEnd"); - }, checkEmptyCell_kaidan: function() { this.checkAllCell(function(cell) { return cell.lcnt === 0 && !cell.isShade() && cell.noNum(); @@ -632,6 +659,9 @@ }, "cuEndpoint"); } }, + "AnsCheck@wittgen#1": { + checklist: ["checkLineOverlap", "checkMissingEnd"] + }, "FailCode@takoyaki": { lnOnShade: "lnOnShade" } From d5a3fc2bf47cf9fc89bf284e966fbf41afb61b82 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 30 Jul 2023 20:31:17 +0200 Subject: [PATCH 02/14] Implement failchecks --- src/res/failcode.en.json | 4 +++ src/variety/kaidan.js | 60 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/res/failcode.en.json b/src/res/failcode.en.json index 4e1cab1fb..dae3037d4 100644 --- a/src/res/failcode.en.json +++ b/src/res/failcode.en.json @@ -391,6 +391,7 @@ "cu3.aqre": "There are more than three unshaded cells in a row.", "cuConnOut": "Some unshaded cells are not connected to the outside.", "cuDivide.kaidan": "The rectangles are divided.", + "cuDivide.wittgen": "The cells not used by rectangles are divided.", "cuDivide": "The unshaded cells are divided.", "cuDivideRB": "The unshaded cells are divided.", "cuEndpoint.takoyaki": "An endpoint does not have a circle.", @@ -518,6 +519,7 @@ "lnLenGt.reflect": "The lines passing a triangle are too long.", "lnLengthGt.pencils": "A line is longer than the connected pencil.", "lnLengthLt.pencils": "A line is shorter than the connected pencil.", + "lnLengthNe3.wittgen": "A block does not cover exactly 3 cells.", "lnLenLt.anglers": "A line is shorter than the number.", "lnLenLt.reflect": "The lines passing a triangle are too short.", "lnMultipleTips.pencils": "A line connects to more than one pencil tip.", @@ -628,8 +630,10 @@ "nmIgnored.herugolf": "There is a Hole without a ball.", "nmIneqNe.minarism": "A inequality sign is not correct.", "nmLineGt.hashikake": "The number of connecting bridges to a number is not correct.", + "nmLineGt.wittgen": "The number of blocks adjacent to a number is not correct.", "nmLineGt1.amibo": "Multiple lines connect to a white circle.", "nmLineLt.hashikake": "The number of connecting bridges to a number is not correct.", + "nmLineLt.wittgen": "The number of blocks adjacent to a number is not correct.", "nmLineLt2.kouchoku": "A clue doesn't have two segments.", "nmLineNe.ichimaga": "The number is not equal to the number of lines out of the circle.", "nmLineNe.lither": "The number is not equal to the number of lines around it.", diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index c49af4cba..03fb58638 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -262,6 +262,17 @@ return !cell.noLP(); } }, + "AreaUnshadeGraph@wittgen": { + enabled: true, + relation: { "border.line": "block" }, + isnodevalid: function(cell) { + return cell.lcnt === 0; + }, + modifyOtherInfo: function(border, relation) { + this.setEdgeByNodeObj(border.sidecell[0]); + this.setEdgeByNodeObj(border.sidecell[1]); + } + }, Graphic: { hideHatena: true, @@ -660,7 +671,54 @@ } }, "AnsCheck@wittgen#1": { - checklist: ["checkLineOverlap", "checkMissingEnd"] + checklist: [ + "checkDir4BlockOver", + "checkConnectUnshade", + "checkLineOverlap", + "checkLineLength", + "checkDir4BlockLess", + "checkMissingEnd" + ], + checkLineLength: function() { + var paths = this.board.linegraph.components; + for (var r = 0; r < paths.length; r++) { + var path = paths[r]; + if (path.clist.length === 3) { + continue; + } + if ( + path.clist.length === 2 && + (!path.clist[0].line || !path.clist[1].line) + ) { + continue; + } + + this.failcode.add("lnLengthNe3"); + if (this.checkOnly) { + break; + } + this.board.border.setnoerr(); + path.setedgeerr(1); + } + }, + checkDir4BlockOver: function() { + this.checkDir4Cell( + function(cell) { + return cell.lcnt; + }, + 2, + "nmLineGt" + ); + }, + checkDir4BlockLess: function() { + this.checkDir4Cell( + function(cell) { + return cell.lcnt; + }, + 1, + "nmLineLt" + ); + } }, "FailCode@takoyaki": { lnOnShade: "lnOnShade" From 62adc005d13d1a4c391245dd34077b700797be11 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Fri, 4 Aug 2023 20:41:19 +0200 Subject: [PATCH 03/14] Add example --- test/script/wittgen.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/script/wittgen.js diff --git a/test/script/wittgen.js b/test/script/wittgen.js new file mode 100644 index 000000000..87bf6faad --- /dev/null +++ b/test/script/wittgen.js @@ -0,0 +1,12 @@ +/* wittgen.js */ + +ui.debug.addDebugData("wittgen", { + url: "6/6/n0drchbj", + failcheck: [ + [ + null, + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 2 0 2 /2 0 0 0 2 2 /0 2 0 2 0 0 /2 0 0 0 2 2 /0 2 0 2 0 0 /0 0 0 0 0 0 /0 0 0 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 0 /1 0 0 0 1 1 /1 1 0 1 1 1 /0 1 0 1 0 0 /0 0 0 0 0 0 /" + ] + ], + inputs: [] +}); From f0759b1da513b7fe7619f0a6e09d0a6c541ecf46 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Fri, 4 Aug 2023 20:58:59 +0200 Subject: [PATCH 04/14] Add failchecks --- test/script/wittgen.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/script/wittgen.js b/test/script/wittgen.js index 87bf6faad..a585fa1f4 100644 --- a/test/script/wittgen.js +++ b/test/script/wittgen.js @@ -3,6 +3,30 @@ ui.debug.addDebugData("wittgen", { url: "6/6/n0drchbj", failcheck: [ + [ + "nmLineGt", + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /2 0 2 0 0 0 /0 2 0 2 0 0 /2 0 2 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /1 1 0 0 0 /0 1 1 0 0 /1 1 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /" + ], + [ + "nmLineLt", + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 2 0 2 0 0 /2 0 2 2 0 2 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 1 1 0 0 /1 1 0 1 1 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /" + ], + [ + "lnLengthNe3", + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /2 0 0 2 0 0 /0 0 0 0 0 0 /0 0 0 0 2 2 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /1 1 1 0 0 /0 0 0 0 0 /0 0 0 0 1 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /" + ], + [ + "laCurve", + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 2 0 0 0 /0 0 0 0 0 0 /2 0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /1 1 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 1 0 0 0 /0 0 1 0 0 0 /" + ], + [ + "cuDivide", + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 2 0 2 /2 0 0 0 2 0 /0 0 0 2 0 0 /2 0 0 0 2 0 /0 0 0 2 0 0 /2 0 2 2 0 2 /0 0 0 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /1 1 0 1 1 /0 0 0 0 0 0 /1 0 0 0 1 0 /1 0 0 1 1 0 /0 0 0 1 0 0 /0 0 0 0 0 0 /" + ], + [ + "ceNoEnd", + "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 2 0 2 /0 0 0 0 2 2 /0 0 0 2 0 0 /2 0 0 0 0 2 /0 2 0 0 0 0 /0 0 0 0 0 0 /0 0 0 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 1 1 /1 0 0 1 1 1 /0 1 0 1 0 0 /0 0 0 0 0 0 /" + ], [ null, "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 2 0 2 /2 0 0 0 2 2 /0 2 0 2 0 0 /2 0 0 0 2 2 /0 2 0 2 0 0 /0 0 0 0 0 0 /0 0 0 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 0 /1 0 0 0 1 1 /1 1 0 1 1 1 /0 1 0 1 0 0 /0 0 0 0 0 0 /" From 333170adfc60fc661d92a3f66586ed9fd07f523a Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 6 Aug 2023 16:52:22 +0200 Subject: [PATCH 05/14] Improve aux marks --- src/variety/kaidan.js | 119 ++++++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 28 deletions(-) diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index 03fb58638..378011303 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -65,7 +65,7 @@ } else if (this.btn === "right" && this.inputpeke_ifborder()) { return; } else if (this.pid === "wittgen") { - this.inputBGcolor(); + this.inputShade(); } else { this.inputcell(); } @@ -181,17 +181,24 @@ "MouseEvent@wittgen#2": { inputModes: { edit: ["number", "undef", "clear"], - play: ["line", "peke", "bgcolor", "bgcolor1", "bgcolor2", "completion"] + play: ["line", "peke", "subcircle", "objblank", "completion"] }, inputShade: function() { - this.inputBGcolor(); + if (this.puzzle.getConfig("use") === 2) { + this.inputBGcolor(); + } else { + this.inputFixedQsub(this.btn === "left" ? 1 : 2); + } + }, + inputDot: function() { + this.inputFixedQsub(2); } }, KeyEvent: { enablemake: true }, - "Border@kaidan,wittgen": { + "Border@kaidan": { prehook: { line: function(num) { return (num && this.isLineNG()) || this.checkFormCurve(num); @@ -212,6 +219,27 @@ "Border@takoyaki": { enableLineNG: true }, + "Border@wittgen": { + prehook: { + line: function(num) { + return (num && this.isLineNG()) || this.checkFormCurve(num); + } + }, + posthook: { + line: function() { + for (var i in this.sidecell) { + var cell = this.sidecell[i]; + if (cell.line && cell.lcnt !== 1) { + cell.setLineVal(0); + } + if (this.line && cell.qsub) { + cell.setQsub(0); + } + cell.draw(); + } + } + } + }, Cell: { maxnum: 4, @@ -243,6 +271,16 @@ return this.qnum === -1; } }, + "Cell@wittgen": { + isDot: function() { + return this.qsub === 2 && this.lcnt === 0; + }, + prehook: { + qsub: function(num) { + return num && (this.isNum() || this.lcnt > 0); + } + } + }, Board: { cols: 8, @@ -275,14 +313,10 @@ }, Graphic: { - hideHatena: true, - gridcolor_type: "LIGHT", - fontShadecolor: "white", fgcellcolor_func: "qnum", qcmpcolor: "rgb(127,127,127)", - mbcolor: "rgb(127,127,255)", paint: function() { this.drawBGCells(); @@ -296,6 +330,9 @@ if (this.pid !== "wittgen") { this.drawCircles(); this.drawCrosses(); + } else { + this.drawDotCells(); + this.drawMBs(); } this.drawLines(); @@ -307,6 +344,30 @@ this.drawChassis(); this.drawTarget(); + } + }, + "Graphic@kaidan,takoyaki#2": { + hideHatena: true, + mbcolor: "rgb(127,127,255)", + fontShadecolor: "white", + getQuesNumberColor: function(cell) { + return cell.qcmp === 1 ? this.qcmpcolor : this.fontShadecolor; + }, + + getCircleStrokeColor: function(cell) { + if (cell.qans === 1) { + if (cell.error === 1) { + return this.errcolor1; + } else if (cell.trial) { + return this.trialcolor; + } else { + return this.quescolor; + } + } + return null; + }, + getCircleFillColor: function(cell) { + return null; }, drawCrosses: function() { var g = this.vinc("cell_mb", "auto"); @@ -330,25 +391,6 @@ g.vhide(); } } - }, - - getQuesNumberColor: function(cell) { - return cell.qcmp === 1 ? this.qcmpcolor : this.fontShadecolor; - }, - getCircleStrokeColor: function(cell) { - if (cell.qans === 1) { - if (cell.error === 1) { - return this.errcolor1; - } else if (cell.trial) { - return this.trialcolor; - } else { - return this.quescolor; - } - } - return null; - }, - getCircleFillColor: function(cell) { - return null; } }, "Graphic@kaidan,wittgen": { @@ -435,12 +477,33 @@ irowake: true }, "Graphic@wittgen#2": { - bgcellcolor_func: "qsub2", getQuesNumberColor: function(cell) { if ((cell.error || cell.qinfo) === 1) { return this.errcolor1; } return cell.qcmp ? this.qcmpcolor : this.quescolor; + }, + drawMBs: function() { + var g = this.vinc("cell_mb", "auto", true); + g.lineWidth = 1; + + var rsize = this.cw * 0.35; + var clist = this.range.cells; + for (var i = 0; i < clist.length; i++) { + var cell = clist[i], + px, + py; + + g.vid = "c_MB1_" + cell.id; + if (cell.qsub === 1) { + px = cell.bx * this.bw; + py = cell.by * this.bh; + g.strokeStyle = !cell.trial ? this.mbcolor : "rgb(192, 192, 192)"; + g.strokeCircle(px, py, rsize); + } else { + g.vhide(); + } + } } }, From ff19e070001b1fd357da901e834fb7ec0f4c7be7 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 6 Aug 2023 16:56:51 +0200 Subject: [PATCH 06/14] Fix qsub save error --- src/variety/kaidan.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index 378011303..f39b47499 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -521,7 +521,11 @@ this.decodeCell(function(cell, ca) { var val = +ca; if (val & 1) { - cell.qans = 1; + if (this.pid === "wittgen") { + cell.qsub = 2; + } else { + cell.qans = 1; + } } if (val & 2) { cell.line = 1; @@ -538,10 +542,10 @@ encodeData: function() { this.encodeCellQnum(); this.encodeCell(function(cell) { - return ( - (cell.qans | (cell.line << 1) | (cell.qsub << 2) | (cell.qcmp << 3)) + - " " - ); + var ans = this.pid === "wittgen" ? cell.qsub === 2 : cell.qans === 1; + var sub = cell.qsub === 1; + + return (+ans | (cell.line << 1) | (+sub << 2) | (cell.qcmp << 3)) + " "; }); this.encodeBorderLine(); } From cb68de938e958848f4d9c9f8cf74a57b2be0d4bf Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 6 Aug 2023 18:49:39 +0200 Subject: [PATCH 07/14] Enforce maximum length --- src/variety/kaidan.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index f39b47499..9b7dd3bdf 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -222,7 +222,29 @@ "Border@wittgen": { prehook: { line: function(num) { - return (num && this.isLineNG()) || this.checkFormCurve(num); + if (!num) { + return false; + } + + if (this.isLineNG() || this.checkFormCurve(num)) { + return true; + } + + var length = 0; + + if (this.isVert() && this.relbd(-2, 0).path) { + length += this.relbd(-2, 0).path.clist.length; + } + if (this.isVert() && this.relbd(2, 0).path) { + length += this.relbd(2, 0).path.clist.length; + } + if (!this.isVert() && this.relbd(0, -2).path) { + length += this.relbd(0, -2).path.clist.length; + } + if (!this.isVert() && this.relbd(0, 2).path) { + length += this.relbd(0, 2).path.clist.length; + } + return length >= 3; } }, posthook: { From f8f6235092d3e73ea4e2e7d1ab97ba16162c3d1b Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 6 Aug 2023 19:10:52 +0200 Subject: [PATCH 08/14] Auto-close rectangles of size 3 --- src/variety/kaidan.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index 9b7dd3bdf..9a803a0c1 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -259,6 +259,15 @@ } cell.draw(); } + if (this.path && this.path.clist.length === 3) { + for (var c = 0; c < 3; c++) { + var cell = this.path.clist[c]; + if (cell.lcnt === 1) { + cell.setLineVal(1); + cell.draw(); + } + } + } } } }, From 74fffad06fd6a313be79d7675ab93ad2061643d4 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 6 Aug 2023 19:49:51 +0200 Subject: [PATCH 09/14] Add input tests --- test/script/wittgen.js | 56 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/test/script/wittgen.js b/test/script/wittgen.js index a585fa1f4..7b3853c0b 100644 --- a/test/script/wittgen.js +++ b/test/script/wittgen.js @@ -32,5 +32,59 @@ ui.debug.addDebugData("wittgen", { "pzprv3/wittgen/6/6/. . . . . . /. . 0 3 . . /. . . . . . /. . . . . . /2 . . . . 1 /. . . . . . /0 0 0 2 0 2 /2 0 0 0 2 2 /0 2 0 2 0 0 /2 0 0 0 2 2 /0 2 0 2 0 0 /0 0 0 0 0 0 /0 0 0 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 0 /1 0 0 0 1 1 /1 1 0 1 1 1 /0 1 0 1 0 0 /0 0 0 0 0 0 /" ] ], - inputs: [] + inputs: [ + { + label: "Test UnshadeGraph updates", + input: [ + "newboard,4,2", + "playmode", + "mouse,left,1,1,5,1", + "mouse,left,3,3,7,3" + ], + result: function(puzzle, assert) { + assert.notEqual( + puzzle.board.getc(7, 1).ublk, + puzzle.board.getc(1, 3).ublk + ); + } + }, + { + label: "Input aux marks", + input: [ + "newboard,3,3", + "mouse,left,1,3", + "mouse,right,3,3", + "mouse,right,5,1,5,3" + ], + result: + "pzprv3/wittgen/3/3/. . . /. . . /. . . /0 0 1 /4 1 1 /0 0 0 /0 0 /0 0 /0 0 /0 0 0 /0 0 0 /" + }, + { + label: "Remove aux marks", + input: ["mouse,left,1,3,3,3", "mouse,left,1,3"], + result: + "pzprv3/wittgen/3/3/. . . /. . . /. . . /0 0 1 /2 0 1 /0 0 0 /0 0 /1 0 /0 0 /0 0 0 /0 0 0 /" + }, + { + label: "Stop corners", + input: ["mouse,left,3,5,5,5,5,1"], + result: + "pzprv3/wittgen/3/3/. . . /. . . /. . . /0 0 0 /2 0 0 /0 0 0 /0 0 /1 0 /0 1 /0 0 1 /0 0 0 /" + }, + { + label: "Auto-close on 3", + input: ["newboard,6,1", "mouse,left,1,1,11,1"], + result: "pzprv3/wittgen/1/6/. . . . . . /2 0 2 2 0 2 /1 1 0 1 1 /" + }, + { + label: "Erase lines", + input: ["mouse,left,3,1,9,1", "playmode,objblank", "mouse,left,5,1,7,1"], + result: "pzprv3/wittgen/1/6/. . . . . . /2 0 1 1 0 2 /1 0 0 0 1 /" + }, + { + label: "Cycle aux mark", + input: ["playmode,auto", "setconfig,use,2", "mouse,right,5,1"], + result: "pzprv3/wittgen/1/6/. . . . . . /2 0 4 1 0 2 /1 0 0 0 1 /" + } + ] }); From a97d8cadc69d2b0791a0a36bec4851d5ad7996ee Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sat, 12 Aug 2023 20:54:27 +0200 Subject: [PATCH 10/14] Fix color of line ends --- src/variety/kaidan.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index 9a803a0c1..41dd0246c 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -481,8 +481,10 @@ px = cell.bx * this.bw; py = cell.by * this.bh; - g.fillStyle = cell.trial ? this.trialcolor : this.linecolor; var lm = this.lm + this.addlw / 2; + g.fillStyle = cell.trial + ? this.trialcolor + : this.getLineColor(dir[1]); if (dir[1].isVert()) { g.fillRectCenter( px + (mx + 1) * (dir[2] === cell.RT ? -1 : +1), From 1ba60a0a62ff0bbfaa169b367f6194c43e4accf1 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sat, 12 Aug 2023 21:11:19 +0200 Subject: [PATCH 11/14] Remove ends when shortening line to 2 --- src-ui/js/ui/KeyPopup.js | 3 ++- src/variety/kaidan.js | 23 +++++++++++++++++++++++ test/script/wittgen.js | 15 +++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src-ui/js/ui/KeyPopup.js b/src-ui/js/ui/KeyPopup.js index 2075fd594..caffb999f 100644 --- a/src-ui/js/ui/KeyPopup.js +++ b/src-ui/js/ui/KeyPopup.js @@ -179,7 +179,8 @@ ui.keypopup = { detour: [10, 0], maxi: [10, 0], tetrochain: [10, 0], - brownies: [127, 0] + brownies: [127, 0], + wittgen: [4, 0] }, //--------------------------------------------------------------------------- diff --git a/src/variety/kaidan.js b/src/variety/kaidan.js index 41dd0246c..f3f44efed 100644 --- a/src/variety/kaidan.js +++ b/src/variety/kaidan.js @@ -268,6 +268,29 @@ } } } + if (!this.line && this.isVert()) { + if (this.relbd(-2, 0).line) { + var cell = this.relcell(-3, 0); + cell.setLineVal(0); + cell.draw(); + } + if (this.relbd(2, 0).line) { + var cell = this.relcell(3, 0); + cell.setLineVal(0); + cell.draw(); + } + } else if (!this.line && this.isHorz()) { + if (this.relbd(0, -2).line) { + var cell = this.relcell(0, -3); + cell.setLineVal(0); + cell.draw(); + } + if (this.relbd(0, 2).line) { + var cell = this.relcell(0, 3); + cell.setLineVal(0); + cell.draw(); + } + } } } }, diff --git a/test/script/wittgen.js b/test/script/wittgen.js index 7b3853c0b..1b0c7d4d2 100644 --- a/test/script/wittgen.js +++ b/test/script/wittgen.js @@ -79,12 +79,23 @@ ui.debug.addDebugData("wittgen", { { label: "Erase lines", input: ["mouse,left,3,1,9,1", "playmode,objblank", "mouse,left,5,1,7,1"], - result: "pzprv3/wittgen/1/6/. . . . . . /2 0 1 1 0 2 /1 0 0 0 1 /" + result: "pzprv3/wittgen/1/6/. . . . . . /0 0 1 1 0 0 /1 0 0 0 1 /" }, { label: "Cycle aux mark", input: ["playmode,auto", "setconfig,use,2", "mouse,right,5,1"], - result: "pzprv3/wittgen/1/6/. . . . . . /2 0 4 1 0 2 /1 0 0 0 1 /" + result: "pzprv3/wittgen/1/6/. . . . . . /0 0 4 1 0 0 /1 0 0 0 1 /" + }, + { + label: "Erase lines vertical", + input: [ + "newboard,1,6", + "mouse,left,1,1,1,11", + "mouse,left,1,1,1,3", + "mouse,left,1,9,1,11" + ], + result: + "pzprv3/wittgen/6/1/. /. /. /. /. /. /0 /0 /0 /0 /0 /0 ///////0 /1 /0 /1 /0 /" } ] }); From f3f853989008b49fd81132b60c1e1d2729c6361f Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 13 Aug 2023 13:26:38 +0200 Subject: [PATCH 12/14] Add background --- src-ui/img/wittgen.png | Bin 0 -> 123 bytes src-ui/js/ui/Misc.js | 1 + 2 files changed, 1 insertion(+) create mode 100644 src-ui/img/wittgen.png diff --git a/src-ui/img/wittgen.png b/src-ui/img/wittgen.png new file mode 100644 index 0000000000000000000000000000000000000000..2cd0ed39df2734ad16efedde7cb6c8ff5ab49bf3 GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~wg8_H*9~b` zj~==7qH4-hpop@ki(`ny)Z_#gW}Xxd2F6(oj~h4*6c|DnPCg6>R1tkq$H-9Sz;ID? Show1CIfJLGpUXO@geCy2)E}?_ literal 0 HcmV?d00001 diff --git a/src-ui/js/ui/Misc.js b/src-ui/js/ui/Misc.js index 19e4e0c22..465e26f8b 100755 --- a/src-ui/js/ui/Misc.js +++ b/src-ui/js/ui/Misc.js @@ -185,6 +185,7 @@ function toBGimage(pid) { "voxas", "vslither", "walllogic", + "wittgen", "yinyang" ]; if (imgs.indexOf(pid) >= 0) { From 1bddf66ed419e3449c4f8e2b1486b968eefc47c8 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Mon, 4 Sep 2023 16:46:36 +0200 Subject: [PATCH 13/14] Add to changelog --- src-ui/changes.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-ui/changes.html b/src-ui/changes.html index e627e92e4..f2d147e4f 100644 --- a/src-ui/changes.html +++ b/src-ui/changes.html @@ -33,13 +33,13 @@
    Latest types (all types)
    From 732c82749bd7876e91e0338f59f85a261c6c808b Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Mon, 4 Sep 2023 19:24:27 +0200 Subject: [PATCH 14/14] format --- src-ui/js/ui/KeyPopup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-ui/js/ui/KeyPopup.js b/src-ui/js/ui/KeyPopup.js index a35153e32..0c0cdfd62 100644 --- a/src-ui/js/ui/KeyPopup.js +++ b/src-ui/js/ui/KeyPopup.js @@ -184,7 +184,7 @@ ui.keypopup = { patchwork: [10, 0], waterwalk: [10, 0], haisu: [10, 0], - wittgen: [4, 0] + wittgen: [4, 0] }, //---------------------------------------------------------------------------