From 5ad1e71f8b920a3e9461f9b2d5e43ac5c37dd755 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Wed, 25 Mar 2026 13:26:56 +0100 Subject: [PATCH 1/2] Add Suguru --- src-ui/js/ui/KeyPopup.js | 1 + src-ui/list.html | 1 + src/pzpr/variety.js | 1 + src/variety/ripple.js | 6 +++--- test/script/suguru.js | 24 ++++++++++++++++++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 test/script/suguru.js diff --git a/src-ui/js/ui/KeyPopup.js b/src-ui/js/ui/KeyPopup.js index 7f09d33a2..71c06cfba 100644 --- a/src-ui/js/ui/KeyPopup.js +++ b/src-ui/js/ui/KeyPopup.js @@ -248,6 +248,7 @@ ui.keypopup = { bhaibahan: [10, 0], edamame: [4, 0], heavydots: [10, 0], + suguru: [10, 10], marutaring: [10, 0], tetroctb: [10, 0], hasunomura: [10, 0], diff --git a/src-ui/list.html b/src-ui/list.html index 639666d0e..0cb6c1a24 100644 --- a/src-ui/list.html +++ b/src-ui/list.html @@ -376,6 +376,7 @@

パズルの種類のリスト
  • +
  • diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index 018951f69..41fe726c8 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -433,6 +433,7 @@ stostone: [0, 0, "ストストーン", "Stostone", "shimaguni"], subomino: [0, 0, "Subomino", "Subomino", "nawabari"], sudoku: [0, 1, "数独", "Sudoku"], + suguru: [0, 0, "ナンバーブロック", "Suguru (Capsules)", "ripple"], sukoro: [1, 0, "数コロ", "Sukoro", "sukoro"], sukororoom: [0, 0, "数コロ部屋", "Sukoro-room", "sukoro"], sumiwake: [0, 0, "すみわけ", "Sumiwake", "heyawake"], diff --git a/src/variety/ripple.js b/src/variety/ripple.js index c9fa8bf5b..02f2b7cf7 100644 --- a/src/variety/ripple.js +++ b/src/variety/ripple.js @@ -7,7 +7,7 @@ } else { pzpr.classmgr.makeCustom(pidlist, classbase); } -})(["ripple", "cojun", "meander"], { +})(["ripple", "cojun", "meander", "suguru"], { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -120,7 +120,7 @@ Board: { hasborder: 1 }, - "Board@cojun": { + "Board@cojun,suguru": { cols: 8, rows: 8 }, @@ -223,7 +223,7 @@ "checkRippleNumber@ripple", "checkAdjacentDiffNumber@cojun", "checkUpperNumber@cojun", - "checkAdjacentNumbers@meander", + "checkAdjacentNumbers@meander,suguru", "checkConsecutiveNeighbors@meander", "checkNoNumCell+" ], diff --git a/test/script/suguru.js b/test/script/suguru.js new file mode 100644 index 000000000..89ac87dab --- /dev/null +++ b/test/script/suguru.js @@ -0,0 +1,24 @@ +/* suguru.js */ + +ui.debug.addDebugData("suguru", { + url: "5/5/cih47bs73m3g5p1g2g", + failcheck: [ + [ + "bkDupNum", + "pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. . . . . /. . 1 . 4 /. 3 2 . . /2 4 5 . . /3 . 3 . 1 /" + ], + [ + "nmAround", + "pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. . 1 . . /. 1 . . 1 /. . . . . /. . . . . /. . . . . /" + ], + [ + "ceNoNum", + "pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. . 1 2 1 /1 . . . . /. 2 1 2 1 /. . . 4 3 /. . 3 . 1 /" + ], + [ + null, + "pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. 2 1 2 1 /1 4 5 . 4 /. 2 1 2 1 /3 4 5 4 3 /2 . 3 . 1 /" + ] + ], + inputs: [] +}); From db7213925a26cd054b67ac8c94990f35e392befa Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Fri, 27 Mar 2026 09:04:55 +0100 Subject: [PATCH 2/2] Add invalid cells --- src/variety/ripple.js | 66 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/src/variety/ripple.js b/src/variety/ripple.js index 02f2b7cf7..f66cda9c6 100644 --- a/src/variety/ripple.js +++ b/src/variety/ripple.js @@ -12,7 +12,7 @@ // マウス入力系 MouseEvent: { inputModes: { - edit: ["border", "number", "clear"], + edit: ["border", "empty", "number", "clear"], play: ["number", "clear"] }, autoedit_func: "areanum", @@ -20,7 +20,7 @@ }, "MouseEvent@meander": { inputModes: { - edit: ["border", "number", "clear"], + edit: ["border", "empty", "number", "clear"], play: ["number", "dragnum+", "dragnum-", "clear"] }, mouseinput: function() { @@ -106,7 +106,18 @@ // キーボード入力系 KeyEvent: { enablemake: true, - enableplay: true + enableplay: true, + + keyinput: function(ca) { + if ((ca === "q" || ca === "w") && this.puzzle.editmode) { + var cell = this.cursor.getc(); + if (!cell.isnull) { + cell.setValid(cell.ques !== 7 ? 7 : 0); + } + } else { + this.key_inputqnum(ca); + } + } }, //--------------------------------------------------------- @@ -117,6 +128,13 @@ return this.room.clist.length; } }, + Border: { + isQuesBorder: function() { + return ( + this.ques || this.sidecell[0].isEmpty() || this.sidecell[1].isEmpty() + ); + } + }, Board: { hasborder: 1 }, @@ -139,6 +157,13 @@ Graphic: { gridcolor_type: "DLIGHT", + getBGCellColor: function(cell) { + if (!cell.isValid()) { + return "black"; + } + return this.getBGCellColor_error1(cell); + }, + paint: function() { this.drawBGCells(); this.drawTargetSubNumber(); @@ -153,6 +178,14 @@ this.drawChassis(); this.drawCursor(); + }, + + getBorderColor: function(border) { + if (border.isQuesBorder()) { + return border.error === 1 ? this.errcolor1 : "black"; + } + + return this.getBorderColor_qans(border); } }, @@ -162,10 +195,12 @@ decodePzpr: function(type) { this.decodeBorder(); this.decodeNumber16(); + this.decodeEmpty(); }, encodePzpr: function(type) { this.encodeBorder(); this.encodeNumber16(); + this.encodeEmpty(); }, decodeKanpen: function() { @@ -212,6 +247,31 @@ this.encodeCellAnum_XMLAnswer(); }, + decodeCellQnum: function() { + this.decodeCell(function(cell, ca) { + if (ca === "#") { + cell.ques = 7; + } else if (ca === "-") { + cell.qnum = -2; + } else if (ca !== ".") { + cell.qnum = +ca; + } + }); + }, + encodeCellQnum: function() { + this.encodeCell(function(cell) { + if (cell.ques === 7) { + return "# "; + } else if (cell.qnum >= 0) { + return cell.qnum + " "; + } else if (cell.qnum === -2) { + return "- "; + } else { + return ". "; + } + }); + }, + UNDECIDED_NUM_XML: 0 },