From 1369cf6bbea41aaddc1b8a37426f5231fb65ee83 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Wed, 22 Jan 2025 20:59:23 +0100 Subject: [PATCH 01/11] WIP --- src/pzpr/variety.js | 1 + src/variety/nagenawa.js | 124 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 120 insertions(+), 5 deletions(-) diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index f613e3dfe..7183de2ed 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -310,6 +310,7 @@ ovotovata: [0, 0, "Ovotovata", "Ovotovata", "country"], oneroom: [0, 0, "ワンルームワンドア", "One Room One Door", "heyawake"], onsen: [0, 0, "温泉めぐり", "Onsen-meguri", "country"], + orbital: [0, 0, "オービタル", "Orbital", "nagenawa"], oyakodori: [0, 0, "おやこどり", "Oyakodori", "kaero"], paintarea: [1, 0, "ペイントエリア", "Paintarea"], parquet: [0, 0, "Parquet", "Parquet"], diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index 3715e7883..d9582c062 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -7,7 +7,7 @@ } else { pzpr.classmgr.makeCustom(pidlist, classbase); } -})(["nagenawa", "ringring"], { +})(["nagenawa", "ringring", "orbital"], { //--------------------------------------------------------- // マウス入力系 "MouseEvent@nagenawa": { @@ -19,6 +19,13 @@ "MouseEvent@ringring": { inputModes: { edit: ["info-line"], play: ["line", "peke", "info-line"] } }, + "MouseEvent@orbital": { + inputModes: { + edit: ["number", "ice", "info-line"], + play: ["line", "peke", "info-line"] + } + // TODO cycle white and black circles + }, MouseEvent: { mouseinput_auto: function() { if (this.puzzle.playmode) { @@ -45,6 +52,8 @@ if (this.mousestart) { this.inputblock(); } + } else if (this.pid === "orbital") { + this.inputqnum(); } } }, @@ -61,9 +70,24 @@ //--------------------------------------------------------- // キーボード入力系 - "KeyEvent@nagenawa": { + "KeyEvent@nagenawa,orbital": { enablemake: true }, + "KeyEvent@orbital#1": { + keyinput: function(ca) { + if (ca === "q") { + var cell = this.cursor.getc(); + cell.setQues(cell.ques !== 6 ? 6 : 0); + this.prev = cell; + cell.draw(); + return; + } else if (ca === "w") { + ca = "s1"; + } + + this.key_inputqnum(ca); + } + }, //--------------------------------------------------------- // 盤面管理系 @@ -73,7 +97,28 @@ }, minnum: 0 }, - "Border@ringring": { + "Cell@orbital": { + maxnum: function() { + return (this.board.rows + this.board.cols - 2) << 1; + }, + noLP: function(dir) { + return this.isNum(); + }, + posthook: { + qnum: function(val) { + if (val !== -1 && this.ques === 6) { + this.setQues(0); + } + }, + ques: function(val) { + this.board.roommgr.isStale = true; + if (val === 6) { + this.setQnum(-1); + } + } + } + }, + "Border@ringring,orbital": { enableLineNG: true }, Board: { @@ -117,6 +162,8 @@ this.drawBorders(); } else if (pid === "ringring") { this.drawQuesCells(); + } else if (this.pid === "orbital") { + this.drawCircledNumbers(); } this.drawLines(); @@ -130,6 +177,25 @@ "Graphic@ringring": { drawTarget: function() {} }, + "Graphic@orbital": { + hideHatena: true, + fontShadecolor: "white", + numbercolor_func: "fixed_shaded", + getCircleStrokeColor: function(cell) { + if (!cell.ice()) { + return null; + } + var error = cell.error || cell.qinfo; + return error === 1 || error === 4 ? this.errcolor1 : this.quescolor; + }, + getCircleFillColor: function(cell) { + if (!cell.isNum()) { + return null; + } + var error = cell.error || cell.qinfo; + return error === 1 || error === 4 ? this.errcolor1 : this.quescolor; + } + }, //--------------------------------------------------------- // URLエンコード/デコード処理 @@ -197,11 +263,19 @@ count = 0; } } - //if(count>0){ cm += count.toString(36);} - this.outbstr += cm; } }, + "Encode@orbital": { + decodePzpr: function() { + this.decodeIce(); + this.decodeNumber16(); + }, + encodePzpr: function() { + this.encodeIce(); + this.encodeNumber16(); + } + }, //--------------------------------------------------------- "FileIO@nagenawa": { decodeData: function() { @@ -240,6 +314,34 @@ }); } }, + "FileIO@orbital": { + decodeData: function() { + this.decodeCell(function(cell, ca) { + if (ca === "#") { + cell.ques = 6; + } else if (ca === "-") { + cell.qnum = -2; + } else if (ca !== ".") { + cell.qnum = +ca; + } + }); + this.decodeBorderLine(); + }, + encodeData: function() { + this.encodeCell(function(cell) { + if (cell.ques === 6) { + return "# "; + } else if (cell.qnum === -2) { + return "- "; + } else if (cell.qnum >= 0) { + return cell.qnum + " "; + } else { + return ". "; + } + }); + this.encodeBorderLine(); + } + }, //--------------------------------------------------------- // 正解判定処理実行部 AnsCheck: { @@ -251,6 +353,10 @@ "checkDeadendLine+", "checkLessLineCount@nagenawa", "checkAllLoopRect", + "checkAllCirclePassed@orbital", + // TODO orbit line exists + // TODO multiple orbit lines + // TODO orbit count is not correct "checkUnreachedUnshadeCell+@ringring" ], @@ -331,6 +437,14 @@ } } return true; + }, + checkAllCirclePassed: function() { + this.checkAllCell(function(cell) { + return cell.lcnt === 0 && cell.ice(); + }, "lnIsolate"); } + }, + "FailCode@orbital": { + lnIsolate: "lnIsolate.dotchi" } }); From 381a755f184928319f88ed6cb9ed43c9a2783a7e Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Wed, 22 Jan 2025 22:48:02 +0100 Subject: [PATCH 02/11] AnsChecks --- src/res/failcode.en.json | 5 +- src/variety/nagenawa.js | 135 ++++++++++++++++++++++++++++++++++++--- test/script/orbital.js | 12 ++++ 3 files changed, 142 insertions(+), 10 deletions(-) create mode 100644 test/script/orbital.js diff --git a/src/res/failcode.en.json b/src/res/failcode.en.json index 854b5166c..3463ec053 100644 --- a/src/res/failcode.en.json +++ b/src/res/failcode.en.json @@ -731,6 +731,7 @@ "nmNoLine": "A number is not connected to another number.", "nmNoMove.bonsan": "A circle doesn't start any line.", "nmNoMove.rectslider": "A shaded cell doesn't start any line.", + "nmNoOrbit.orbital": "A black circle is not inside a loop.", "nmNoSideShade.tasquare": "No shaded cells are adjacent to square marks.", "nmNotConsecNeighbors.ripple": "A number is not the neighbor of its consecutive numbers.", "nmNotConseq.kouchoku": "Equal letters are not connected directly.", @@ -742,6 +743,7 @@ "nmNumberNe.sukoro": "The number of numbers placed in four adjacent cells is not equal to the number.", "nmNumberNe.sukororoom": "The number of numbers placed in four adjacent cells is not equal to the number.", "nmNumberNe.view": "The number of numbers placed in four adjacent cells is not equal to the number.", + "nmOrbitNe.orbital": "A number does not indicate the amount of white circles used by the loop.", "nmOutOfBk.oyakodori": "A bird is outside a nest.", "nmOutOfBk.yosenabe": "A filling isn't in a crock.", "nmOutOfHole.herugolf": "A ball doesn't cup in.", @@ -750,15 +752,16 @@ "nmOutsideTren.tren": "A number is not contained inside a 1x2 or 1x3 block.", "nmPillowGt.shugaku": "The number of pillows around the number is wrong.", "nmPillowLt.shugaku": "The number of pillows around the number is wrong.", + "nmPlOrbit.orbital": "A black circle is inside multiple loops.", "nmProduct.factors": "A number of room is not equal to the product of these numbers.", "nmRange.kakuru": "A number is larger than 9.", "nmRange.sananko": "A number is larger than 3.", "nmRange.trainstations": "A number is out of range.", "nmSame2x2.kazunori": "There is a 2x2 block of the same number.", "nmSame2x2.snakepit": "A snake loops back on itself.", - "nmShadeEq.smullyan": "The number of shaded cells in a shaded number's domain is equal to the number.", "nmShade5Ne.lookair": "The number is not equal to the number of shaded cells in the cell and the four adjacent cells.", "nmShadeDiagNe.context": "The number of shaded cells diagonally adjacent to a shaded number is not correct.", + "nmShadeEq.smullyan": "The number of shaded cells in a shaded number's domain is equal to the number.", "nmShadeGt.interbd": "The number of shaded cells around a number is not correct.", "nmShadeGt.kaidan": "The number of circles around a number is not correct.", "nmShadeGt.kuromenbun": "The number of shaded cells around an area is not correct.", diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index d9582c062..ee7b0c83a 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -130,7 +130,14 @@ LineGraph: { enabled: true, - isLineCross: true + isLineCross: true, + setExtraData: function(component) { + this.common.setExtraData.call(this, component); + component.bounds = null; + } + }, + "LineGraph@orbital": { + makeClist: true }, "AreaRoomGraph@nagenawa": { @@ -353,10 +360,10 @@ "checkDeadendLine+", "checkLessLineCount@nagenawa", "checkAllLoopRect", + "checkMultipleOrbit@orbital", + "checkOrbitNumber@orbital", + "checkOrbitExists@orbital", "checkAllCirclePassed@orbital", - // TODO orbit line exists - // TODO multiple orbit lines - // TODO orbit count is not correct "checkUnreachedUnshadeCell+@ringring" ], @@ -389,8 +396,8 @@ bd = this.board; var paths = bd.linegraph.components; for (var r = 0; r < paths.length; r++) { - var borders = paths[r].getedgeobjs(); - if (this.isLoopRect(borders)) { + var component = paths[r]; + if (this.getComponentBounds(component)) { continue; } @@ -398,14 +405,23 @@ if (this.checkOnly) { break; } - paths[r].setedgeerr(1); + component.setedgeerr(1); } if (!result) { this.failcode.add("lnNotRect"); bd.border.setnoerr(); } }, - isLoopRect: function(borders) { + getComponentBounds: function(component) { + var bounds = component.bounds; + if (bounds === null) { + var borders = component.getedgeobjs(); + component.bounds = this.calculateComponentBounds(borders); + return component.bounds; + } + return bounds; + }, + calculateComponentBounds: function(borders) { var bd = this.board; var x1 = bd.maxbx, x2 = bd.minbx, @@ -425,6 +441,9 @@ y2 = borders[i].by; } } + + // TODO add an expected count + for (var i = 0; i < borders.length; i++) { var border = borders[i]; if ( @@ -436,8 +455,106 @@ return false; } } - return true; + return { x1: x1, x2: x2, y1: y1, y2: y2 }; + } + }, + "AnsCheck@orbital": { + checkOrbitExists: function() { + var orbits = this.getOrbitData(); + + this.checkAllCell(function(cell) { + return cell.isNum() && !orbits[cell.id]; + }, "nmNoOrbit"); }, + checkMultipleOrbit: function() { + var orbits = this.getOrbitData(); + var result = true; + + for (var id in orbits) { + var count = orbits[id].length; + if (count === 1) { + continue; + } + + result = false; + if (this.checkOnly) { + break; + } + this.board.cell[+id].seterr(1); + for (var x = 0; x < count; x++) { + orbits[id][x].setedgeerr(1); + } + } + if (!result) { + this.failcode.add("nmPlOrbit"); + this.board.border.setnoerr(); + } + }, + checkOrbitNumber: function() { + var orbits = this.getOrbitData(); + var result = true; + + for (var id in orbits) { + if (orbits[id].length !== 1) { + continue; + } + var cell = this.board.cell[+id]; + if (!cell.isValidNum()) { + continue; + } + + var circles = orbits[id][0].clist.filter(function(o) { + return o.ice(); + }); + if (circles.length === cell.getNum()) { + continue; + } + + result = false; + if (this.checkOnly) { + break; + } + this.board.cell[+id].seterr(1); + orbits[id][0].setedgeerr(1); + } + if (!result) { + this.failcode.add("nmOrbitNe"); + this.board.border.setnoerr(); + } + }, + + getOrbitData: function() { + if (this._info.orbits) { + return this._info.orbits; + } + + var ret = {}; + var bd = this.board; + var paths = bd.linegraph.components; + for (var r = 0; r < paths.length; r++) { + var component = paths[r]; + var bounds = this.getComponentBounds(component); + if (!bounds) { + continue; + } + + var cells = bd.cellinside(bounds.x1, bounds.y1, bounds.x2, bounds.y2); + cells.each(function(cell) { + if (!cell.isNum()) { + return; + } + + var id = cell.id + ""; + if (!(id in ret)) { + ret[id] = []; + } + ret[id].push(component); + }); + } + + return (this._info.orbits = ret); + }, + checkAllCirclePassed: function() { this.checkAllCell(function(cell) { return cell.lcnt === 0 && cell.ice(); diff --git a/test/script/orbital.js b/test/script/orbital.js new file mode 100644 index 000000000..4bb862d5c --- /dev/null +++ b/test/script/orbital.js @@ -0,0 +1,12 @@ +/* orbital.js */ + +ui.debug.addDebugData("orbital", { + url: "6/6/q06k0400m3x2o", + failcheck: [ + [ + null, + "pzprv3/orbital/6/6/# # . # . . /. 3 . . . . /# # . # . # /. . . . . . /. . 2 # . . /. . . . . . /1 1 0 1 1 /0 0 0 0 0 /0 1 1 1 0 /1 1 0 0 0 /0 0 0 1 1 /0 1 1 1 0 /1 0 1 1 0 1 /1 0 1 1 0 1 /1 1 1 1 1 1 /0 1 0 1 1 1 /0 1 0 0 1 0 /" + ] + ], + inputs: [] +}); From f376e67c34d773871dc4cc980c7d9c263d00ba86 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Thu, 23 Jan 2025 18:50:09 +0100 Subject: [PATCH 03/11] Improve rectangle detection --- src/variety/nagenawa.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index ee7b0c83a..1a5bc8e84 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -442,7 +442,15 @@ } } - // TODO add an expected count + /* All coordinates must be even numbers, otherwise this can't be a cell rectangle */ + if ((x1 & x2 & y1 & y2 & 1) === 0) { + return false; + } + + var expected = x2 - x1 + (y2 - y1); + if (borders.length !== expected) { + return false; + } for (var i = 0; i < borders.length; i++) { var border = borders[i]; From 484264d98e09f41c20d027b47c3a795408a6a89d Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 26 Jan 2025 12:18:12 +0100 Subject: [PATCH 04/11] Add keypopup, listing --- src-ui/js/ui/KeyPopup.js | 3 ++- src-ui/list.html | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src-ui/js/ui/KeyPopup.js b/src-ui/js/ui/KeyPopup.js index 51df41751..c77e5fac9 100644 --- a/src-ui/js/ui/KeyPopup.js +++ b/src-ui/js/ui/KeyPopup.js @@ -217,7 +217,8 @@ ui.keypopup = { yajirushi2: [4, 0], nibunnogo: [4, 0], mintonette: [10, 0], - balloon: [10, 0] + balloon: [10, 0], + orbital: [10, 0] }, //--------------------------------------------------------------------------- diff --git a/src-ui/list.html b/src-ui/list.html index 2d8ef08e2..741fde036 100644 --- a/src-ui/list.html +++ b/src-ui/list.html @@ -182,6 +182,7 @@

パズルの種類のリスト
  • +
  • From 8ed5b74073f16ef43ebad1fadbcefededf399a58 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Wed, 29 Jan 2025 11:48:21 +0100 Subject: [PATCH 05/11] Add missing checks --- src/res/failcode.en.json | 1 + src/variety/nagenawa.js | 47 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/res/failcode.en.json b/src/res/failcode.en.json index 3463ec053..4b3903ae9 100644 --- a/src/res/failcode.en.json +++ b/src/res/failcode.en.json @@ -622,6 +622,7 @@ "lpNoNum.onsen": "A loop has no numbers.", "lpNoNum.pipelink": "A loop has no numbers.", "lpNumGt2.onsen": "A loop has more than one number.", + "lpNumGt2.orbital": "A loop encloses more than one black circle.", "lpPlNum.pipelink": "A loop has multiple kinds of number.", "lpSepNum.pipelink": "A kind of number is in different loops.", "lrAcrossArrow.nagare": "The line doesn't go straight in the arrow's direction.", diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index 1a5bc8e84..7a1d8b6f1 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -354,13 +354,14 @@ AnsCheck: { checklist: [ "checkLineExist", - "checkLineOnShadeCell@ringring", + "checkLineOnShadeCell@ringring,orbital", "checkOverLineCount@nagenawa", "checkBranchLine", "checkDeadendLine+", "checkLessLineCount@nagenawa", "checkAllLoopRect", "checkMultipleOrbit@orbital", + "checkMultiplePlanets@orbital", "checkOrbitNumber@orbital", "checkOrbitExists@orbital", "checkAllCirclePassed@orbital", @@ -474,6 +475,50 @@ return cell.isNum() && !orbits[cell.id]; }, "nmNoOrbit"); }, + checkLineOnShadeCell: function() { + this.checkAllCell(function(cell) { + return cell.isNum() && cell.lcnt > 0; + }, "lnOnShade"); + }, + checkMultiplePlanets: function() { + var bd = this.board, + paths = bd.linegraph.components; + for (var r = 0; r < paths.length; r++) { + paths[r]._id = r; + } + + var orbits = this.getOrbitData(); + var reverse = {}; + var result = true; + + for (var id in orbits) { + var count = orbits[id].length; + if (count !== 1) { + continue; + } + + var cell = bd.cell[+id]; + + var loop = orbits[id][0]; + var loopid = loop._id + ""; + if (loopid in reverse) { + result = false; + if (this.checkOnly) { + break; + } + loop.setedgeerr(1); + cell.seterr(1); + reverse[loopid].seterr(1); + } else { + reverse[loopid] = cell; + } + } + + if (!result) { + this.failcode.add("lpNumGt2"); + this.board.border.setnoerr(); + } + }, checkMultipleOrbit: function() { var orbits = this.getOrbitData(); var result = true; From f394ca9e914a44e2b8f20e92add4bc78d83aa01d Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sat, 1 Feb 2025 21:15:52 +0100 Subject: [PATCH 06/11] Add example puzzle --- test/script/orbital.js | 44 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/test/script/orbital.js b/test/script/orbital.js index 4bb862d5c..387703471 100644 --- a/test/script/orbital.js +++ b/test/script/orbital.js @@ -1,11 +1,51 @@ /* orbital.js */ ui.debug.addDebugData("orbital", { - url: "6/6/q06k0400m3x2o", + url: "6/6/88o100s0t4s.m", failcheck: [ + [ + "brNoLine", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /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 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 /" + ], + [ + "lnOnShade", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /0 0 0 0 0 /0 0 0 0 0 /1 1 1 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 0 0 0 /1 0 0 1 0 0 /1 0 0 1 0 0 /1 0 0 1 0 0 /" + ], + [ + "lnBranch", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /1 1 1 1 1 /0 0 0 0 0 /1 1 1 1 1 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /1 0 1 0 0 1 /1 0 1 0 0 1 /" + ], + [ + "lnNotRect", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 1 /0 0 0 1 1 /0 0 0 0 0 /1 1 1 0 0 /1 1 0 0 0 /1 1 0 0 0 /1 0 0 0 0 1 /1 0 0 1 0 0 /1 0 0 1 0 0 /0 0 0 0 0 0 /1 0 1 0 0 0 /" + ], + [ + "nmNoOrbit", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 1 /0 0 0 1 0 /0 0 0 1 0 /1 1 1 1 1 /1 1 0 0 0 /1 1 0 0 0 /1 0 0 0 0 1 /1 0 0 1 1 1 /1 0 0 0 0 1 /0 0 0 0 0 0 /1 0 1 0 0 0 /" + ], + [ + "lpNumGt2", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /1 1 1 1 1 /1 0 0 0 0 1 /1 0 0 0 0 1 /1 0 0 0 0 1 /1 0 0 0 0 1 /1 0 0 0 0 1 /" + ], + [ + "nmPlOrbit", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /0 1 1 0 0 /1 1 1 1 0 /0 0 0 0 0 /1 1 1 1 0 /0 1 1 0 0 /0 0 0 0 0 /0 1 0 1 0 0 /1 1 0 1 1 0 /1 1 0 1 1 0 /0 1 0 1 0 0 /0 0 0 0 0 0 /" + ], + [ + "nmOrbitNe", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /0 1 1 1 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 /0 1 0 0 1 0 /0 1 0 0 1 0 /0 1 0 0 1 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /" + ], + [ + "lnIsolate", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 0 /0 0 0 1 1 /0 0 0 0 0 /1 1 1 1 0 /0 0 0 0 0 /0 0 0 1 1 /1 0 0 0 1 0 /1 0 0 1 1 1 /1 0 0 1 1 1 /0 0 0 1 0 1 /0 0 0 1 0 1 /" + ], + [ + "lnDeadEnd", + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 0 /0 0 0 1 1 /0 0 0 0 0 /1 1 1 1 0 /0 0 0 0 0 /1 1 0 1 1 /1 0 0 0 1 0 /1 0 0 1 1 1 /1 0 0 1 1 1 /0 0 0 1 0 1 /1 0 0 1 0 1 /" + ], [ null, - "pzprv3/orbital/6/6/# # . # . . /. 3 . . . . /# # . # . # /. . . . . . /. . 2 # . . /. . . . . . /1 1 0 1 1 /0 0 0 0 0 /0 1 1 1 0 /1 1 0 0 0 /0 0 0 1 1 /0 1 1 1 0 /1 0 1 1 0 1 /1 0 1 1 0 1 /1 1 1 1 1 1 /0 1 0 1 1 1 /0 1 0 0 1 0 /" + "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 0 /0 0 0 1 1 /0 0 0 0 0 /1 1 1 1 0 /1 1 0 0 0 /1 1 0 1 1 /1 0 0 0 1 0 /1 0 0 1 1 1 /1 0 0 1 1 1 /0 0 0 1 0 1 /1 0 1 1 0 1 /" ] ], inputs: [] From 2ebdc0ea5df04faf848ffaf684a4c31b627601ce Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sat, 1 Feb 2025 22:14:33 +0100 Subject: [PATCH 07/11] Rename ice input --- src/variety/nagenawa.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index 7a1d8b6f1..e8feadf0b 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -21,8 +21,15 @@ }, "MouseEvent@orbital": { inputModes: { - edit: ["number", "ice", "info-line"], + edit: ["number", "circle-unshade", "info-line"], play: ["line", "peke", "info-line"] + }, + mouseinput: function() { + if (this.inputMode === "circle-unshade") { + this.inputIcebarn(); + } else { + this.common.mouseinput.call(this); + } } // TODO cycle white and black circles }, From c4f3d5dc49958ae26687088d4d541a9f452af528 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sat, 1 Feb 2025 22:58:42 +0100 Subject: [PATCH 08/11] Improve keypopup --- src-ui/js/ui/KeyPopup.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src-ui/js/ui/KeyPopup.js b/src-ui/js/ui/KeyPopup.js index c77e5fac9..ba72ff96b 100644 --- a/src-ui/js/ui/KeyPopup.js +++ b/src-ui/js/ui/KeyPopup.js @@ -218,7 +218,7 @@ ui.keypopup = { nibunnogo: [4, 0], mintonette: [10, 0], balloon: [10, 0], - orbital: [10, 0] + orbital: [124, 0] }, //--------------------------------------------------------------------------- @@ -880,6 +880,7 @@ ui.keypopup = { }, generate_trainstations: function(mode) { + var orbital = ui.puzzle.pid === "orbital"; this.generate_main( [ "0", @@ -893,8 +894,8 @@ ui.keypopup = { "8", "9", " ", - ["-", "?"], - ["q", "╋"] + ["-", orbital ? "●" : "?"], + ["q", orbital ? "○" : "╋"] ], 4 ); From 336db693247fef5ab87c0b2910739d03258963b0 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 2 Feb 2025 11:46:55 +0100 Subject: [PATCH 09/11] Add mouse inputs --- src/variety/nagenawa.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index e8feadf0b..c622a8706 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -30,8 +30,23 @@ } else { this.common.mouseinput.call(this); } + }, + getNewNumber: function(cell, val) { + if (this.btn === "left" && val === -1) { + return -3; + } else if (this.btn === "left" && val === -2) { + return 0; + } else if (this.btn === "left" && val === cell.getmaxnum()) { + return -1; + } else if (this.btn === "right" && val === 0) { + return -2; + } else if (this.btn === "right" && val === -1) { + return cell.getmaxnum(); + } + + val += this.btn === "left" ? 1 : -1; + return val < -3 ? -1 : val; } - // TODO cycle white and black circles }, MouseEvent: { mouseinput_auto: function() { @@ -111,6 +126,17 @@ noLP: function(dir) { return this.isNum(); }, + getNum: function() { + return this.ice() ? -3 : this.qnum; + }, + setNum: function(val) { + if (val === -3) { + this.setQues(6); + } else { + this.setQues(0); + this.setQnum(val); + } + }, posthook: { qnum: function(val) { if (val !== -1 && this.ques === 6) { From 74b127b280b7b2cf31b0d554d8608fa58baadb00 Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 2 Feb 2025 12:02:18 +0100 Subject: [PATCH 10/11] Add input tests --- src/variety/nagenawa.js | 1 - test/script/nagenawa.js | 4 ++++ test/script/orbital.js | 28 +++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index c622a8706..d5094cb43 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -144,7 +144,6 @@ } }, ques: function(val) { - this.board.roommgr.isStale = true; if (val === 6) { this.setQnum(-1); } diff --git a/test/script/nagenawa.js b/test/script/nagenawa.js index be209ac62..fbd7890b5 100644 --- a/test/script/nagenawa.js +++ b/test/script/nagenawa.js @@ -35,5 +35,9 @@ ui.debug.addDebugData("nagenawa", { inputs: [ /* 回答入力はicebarn, countryと同じなので省略 */ /* 問題入力はcountryと同じなので省略 */ + { + input: ["newboard,2,2", "editmode", "mouse,rightx2,3,3"], + result: "pzprv3/nagenawa/2/2/1/0 0 /0 0 /4 . /. . /0 /0 /0 0 /0 0 /0 0 /" + } ] }); diff --git a/test/script/orbital.js b/test/script/orbital.js index 387703471..93892e2ff 100644 --- a/test/script/orbital.js +++ b/test/script/orbital.js @@ -48,5 +48,31 @@ ui.debug.addDebugData("orbital", { "pzprv3/orbital/6/6/. # . . . . /# . . . # # /. . 4 . . . /. # . . . . /. . . . - . /# # # . . . /1 1 1 1 0 /0 0 0 1 1 /0 0 0 0 0 /1 1 1 1 0 /1 1 0 0 0 /1 1 0 1 1 /1 0 0 0 1 0 /1 0 0 1 1 1 /1 0 0 1 1 1 /0 0 0 1 0 1 /1 0 1 1 0 1 /" ] ], - inputs: [] + inputs: [ + { + input: [ + "newboard,2,2", + "editmode", + "mouse,leftx2,3,1", + "mouse,leftx3,1,3", + "mouse,leftx4,3,3" + ], + result: "pzprv3/orbital/2/2/. # /- 0 /0 /0 /0 0 /" + }, + { + input: [ + "cursor,1,3", + "key,q", + "cursor,3,3", + "key,3", + "editmode,circle-unshade", + "mouse,left,1,1" + ], + result: "pzprv3/orbital/2/2/# # /# 3 /0 /0 /0 0 /" + }, + { + input: ["playmode", "mouse,left,1,3,1,1,3,1,3,3"], + result: "pzprv3/orbital/2/2/# # /# 3 /1 /0 /1 0 /" + } + ] }); From e20fb2cf7885b3921f34236a2cf91cefb45e314c Mon Sep 17 00:00:00 2001 From: Lennard Sprong Date: Sun, 2 Feb 2025 16:44:53 +0100 Subject: [PATCH 11/11] Add background --- src-ui/img/orbital.png | Bin 0 -> 128 bytes src-ui/js/ui/Misc.js | 1 + 2 files changed, 1 insertion(+) create mode 100644 src-ui/img/orbital.png diff --git a/src-ui/img/orbital.png b/src-ui/img/orbital.png new file mode 100644 index 0000000000000000000000000000000000000000..612de122733809143dd40a0669257291ddecbc22 GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh3?wzC-F*zC7>k44ofy`glX(f`a0d8C%L7#Jja W8JyQWot+2Nz~JfX=d#Wzp$P!E&ms%} literal 0 HcmV?d00001 diff --git a/src-ui/js/ui/Misc.js b/src-ui/js/ui/Misc.js index 1d8b7c97d..dfd397bfb 100755 --- a/src-ui/js/ui/Misc.js +++ b/src-ui/js/ui/Misc.js @@ -174,6 +174,7 @@ function toBGimage(pid) { "nurimisaki", "nuriuzu", "oneroom", + "orbital", "ovotovata", "oyakodori", "patchwork",