Skip to content

Commit 23e4536

Browse files
authored
Add Nurikabe Loop
1 parent a4186e1 commit 23e4536

5 files changed

Lines changed: 211 additions & 0 deletions

File tree

src-ui/js/ui/KeyPopup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ ui.keypopup = {
251251
heavydots: [10, 0],
252252
suguru: [10, 10],
253253
marutaring: [10, 0],
254+
nuriloop: [10, 0],
254255
tetroctb: [10, 0],
255256
hasunomura: [10, 0],
256257
bramble: [10, 0],

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
171171
<li data-pid="morningwalk"></li>
172172
<li data-pid="bhaibahan"></li>
173173
<li data-pid="roboticwalk"></li>
174+
<li data-pid="nuriloop"></li>
174175
</ul>
175176
</div>
176177
<div class="lists loops">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@
329329
numrope: [0, 0, "ナンバーロープ", "Number Rope", "kakuru"],
330330
nuribou: [1, 0, "ぬりぼう", "Nuribou", "nurikabe"],
331331
nurikabe: [0, 1, "ぬりかべ", "Nurikabe", "nurikabe"],
332+
nuriloop: [0, 0, "面積リンク", "Nurikabe Loop"],
332333
nurimaze: [0, 0, "ぬりめいず", "Nuri-Maze", "nurimaze"],
333334
nurimisaki: [0, 0, "ぬりみさき", "Nurimisaki", "kurodoko"],
334335
nuritwin: [0, 0, "ぬりツイン", "Nuritwin", "shimaguni"],

src/variety/nuriloop.js

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
(function(pidlist, classbase) {
2+
if (typeof module === "object" && module.exports) {
3+
module.exports = [pidlist, classbase];
4+
} else {
5+
pzpr.classmgr.makeCustom(pidlist, classbase);
6+
}
7+
})(["nuriloop"], {
8+
MouseEvent: {
9+
use: true,
10+
inputModes: {
11+
edit: ["number", "clear", "info-line"],
12+
play: ["line", "peke", "subcircle", "subcross", "info-line"]
13+
},
14+
autoedit_func: "qnum",
15+
autoplay_func: "lineMB"
16+
},
17+
18+
KeyEvent: {
19+
enablemake: true
20+
},
21+
22+
Board: {
23+
hasborder: 1
24+
},
25+
Border: {
26+
enableLineNG: true
27+
},
28+
Cell: {
29+
maxnum: function() {
30+
return this.board.cols * this.board.rows;
31+
},
32+
noLP: function() {
33+
return this.isNum();
34+
},
35+
isUnshade: function() {
36+
return this.lcnt === 0;
37+
}
38+
},
39+
LineGraph: {
40+
enabled: true
41+
},
42+
AreaUnshadeGraph: {
43+
enabled: true,
44+
relation: { "border.line": "block" },
45+
modifyOtherInfo: function(border, relation) {
46+
this.setEdgeByNodeObj(border.sidecell[0]);
47+
this.setEdgeByNodeObj(border.sidecell[1]);
48+
}
49+
},
50+
51+
Graphic: {
52+
irowake: true,
53+
gridcolor_type: "LIGHT",
54+
numbercolor_func: "qnum",
55+
qanscolor: "black",
56+
57+
paint: function() {
58+
this.drawBGCells();
59+
this.drawGrid();
60+
61+
this.drawQuesNumbers();
62+
63+
this.drawMBs();
64+
this.drawLines();
65+
this.drawPekes();
66+
67+
this.drawChassis();
68+
69+
this.drawTarget();
70+
}
71+
},
72+
73+
Encode: {
74+
decodePzpr: function(type) {
75+
this.decodeNumber16();
76+
},
77+
encodePzpr: function(type) {
78+
this.encodeNumber16();
79+
}
80+
},
81+
FileIO: {
82+
decodeData: function() {
83+
this.decodeCellQnum();
84+
this.decodeCellQsub();
85+
this.decodeBorderLine();
86+
},
87+
encodeData: function() {
88+
this.encodeCellQnum();
89+
this.encodeCellQsub();
90+
this.encodeBorderLine();
91+
}
92+
},
93+
94+
AnsCheck: {
95+
checklist: [
96+
"checkLineExist+",
97+
"checkBranchLine",
98+
"checkCrossLine",
99+
"checkLineOverlap",
100+
101+
"checkNoNumberInUnshade",
102+
"checkDoubleNumberInUnshade",
103+
"checkNumberAndUnshadeSize",
104+
105+
"checkDeadendLine+",
106+
"checkOneLoop"
107+
],
108+
109+
checkLineOverlap: function() {
110+
this.checkAllCell(function(cell) {
111+
return cell.lcnt > 0 && cell.qnum !== -1;
112+
}, "lnOverlap");
113+
},
114+
115+
checkDoubleNumberInUnshade: function() {
116+
this.checkAllBlock(
117+
this.board.ublkmgr,
118+
function(cell) {
119+
return cell.isNum();
120+
},
121+
function(w, h, a, n) {
122+
return a < 2;
123+
},
124+
"bkNumGe2"
125+
);
126+
},
127+
checkNumberAndUnshadeSize: function() {
128+
this.checkAllCell(function(cell) {
129+
if (!cell.isValidNum()) {
130+
return false;
131+
}
132+
if (!cell.ublk) {
133+
return true;
134+
}
135+
136+
if (cell.ublk.clist.length !== cell.getNum()) {
137+
cell.ublk.clist.seterr(1);
138+
return true;
139+
}
140+
return false;
141+
}, "bkSizeNe");
142+
},
143+
144+
checkNoNumberInUnshade: function() {
145+
this.checkAllBlock(
146+
this.board.ublkmgr,
147+
function(cell) {
148+
return cell.isNum();
149+
},
150+
function(w, h, a, n) {
151+
return a !== 0;
152+
},
153+
"bkNoNum"
154+
);
155+
}
156+
},
157+
FailCode: {
158+
lnOverlap: "lnOverlap.tontti"
159+
}
160+
});

test/script/nuriloop.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* nuriloop.js */
2+
3+
ui.debug.addDebugData("nuriloop", {
4+
url: "5/5/4m2m1n",
5+
failcheck: [
6+
[
7+
"brNoLine",
8+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /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 /"
9+
],
10+
[
11+
"lnBranch",
12+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /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 1 0 0 /0 0 0 0 0 /0 0 0 0 0 /"
13+
],
14+
[
15+
"lnCross",
16+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /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 1 0 /0 0 0 1 0 /"
17+
],
18+
[
19+
"lnPlLoop",
20+
"pzprv3/nuriloop/5/5/3 . . . . /. . . 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 1 1 /0 1 0 0 /1 0 1 1 /0 0 0 1 /1 1 0 1 /0 0 1 0 1 /0 1 0 0 1 /1 0 1 0 0 /1 0 1 1 1 /"
21+
],
22+
[
23+
"lnOverlap",
24+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 1 1 1 /1 0 0 0 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 1 0 0 0 /"
25+
],
26+
[
27+
"bkNoNum",
28+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 1 1 /1 1 0 0 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 0 0 /"
29+
],
30+
[
31+
"bkNumGe2",
32+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 0 0 /1 1 1 1 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 0 0 1 /"
33+
],
34+
[
35+
"bkSizeNe",
36+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /0 1 1 1 /0 1 0 0 /1 1 0 0 /0 0 1 0 /1 1 0 1 /0 1 0 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 1 1 /"
37+
],
38+
[
39+
"lnDeadEnd",
40+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 1 0 /1 0 1 1 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 0 1 /"
41+
],
42+
[
43+
null,
44+
"pzprv3/nuriloop/5/5/4 . . . . /. . . 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 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 1 0 /1 1 0 1 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 1 1 /"
45+
]
46+
],
47+
inputs: []
48+
});

0 commit comments

Comments
 (0)