Skip to content

Commit 1a4d7ab

Browse files
authored
Add Narrowfence
1 parent 71d92a7 commit 1a4d7ab

10 files changed

Lines changed: 203 additions & 10 deletions

File tree

src-ui/changes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
<main>
3434
<div style="margin-bottom: 5px;"><b>Latest types</b> (<em><a href="/list.html" target="_parent">all types</a></em>)</div>
3535
<ul>
36+
<li><a href="/p?narrow" target="_parent">Narrowfence</a></li>
3637
<li><a href="/p?kurarin" target="_parent">Kurarin クラリン</a></li>
3738
<li><a href="/p?sumiwake" target="_parent">Sumiwake すみわけ</a></li>
3839
<li><a href="/p?wataridori" target="_parent">Wataridori わたりどり</a></li>
3940
<li><a href="/p?forestwalk" target="_parent">Forest Walk</a></li>
4041
<li><a href="/p?arrowflow" target="_parent">Arrow Flow アローフロー</a></li>
4142
<li><a href="/p?retsurin" target="_parent">Retsurin</a></li>
42-
<li><a href="/p?japanesesums" target="_parent">Japanese Sums</a></li>
4343
</ul>
4444
</main>
4545
</body>

src-ui/img/narrow.png

141 Bytes
Loading

src-ui/js/ui/KeyPopup.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ ui.keypopup = {
229229
forestwalk: [10, 0],
230230
onsen: [10, 0],
231231
wataridori: [10, 0],
232-
kurarin: [133, 0]
232+
kurarin: [133, 0],
233+
narrow: [134, 0]
233234
},
234235

235236
//---------------------------------------------------------------------------
@@ -388,6 +389,8 @@ ui.keypopup = {
388389
this.generate_outofsight(mode);
389390
} else if (type === 133) {
390391
this.generate_kurarin(mode);
392+
} else if (type === 134) {
393+
this.generate_narrowfence(mode);
391394
} else if (type === 5339) {
392395
this.generate_swslither();
393396
}
@@ -1076,6 +1079,13 @@ ui.keypopup = {
10761079
);
10771080
},
10781081

1082+
generate_narrowfence: function(mode) {
1083+
this.generate_main(
1084+
[["1", "○"], ["2", "╋"], " ", ["3", "×"], ["4", "◇"]],
1085+
3
1086+
);
1087+
},
1088+
10791089
generate_main: function(list, split) {
10801090
for (var i = 0; i < list.length; i++) {
10811091
this.inputcol(list[i]);

src-ui/js/ui/Misc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ function toBGimage(pid) {
169169
"mrtile",
170170
"mukkonn",
171171
"nanameguri",
172+
"narrow",
172173
"nibunnogo",
173174
"nondango",
174175
"nonogram",

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
284284
<li data-pid="subomino"></li>
285285
<li data-pid="meidjuluk"></li>
286286
<li data-pid="balloon"></li>
287+
<li data-pid="narrow"></li>
287288
</ul>
288289
</div>
289290
<div class="lists divides">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288
nagenawa: [0, 0, "なげなわ", "Nagenawa", "nagenawa"],
289289
nanameguri: [0, 0, "ななめぐり", "Nanameguri"],
290290
nanro: [0, 1, "ナンロー", "Nanro"],
291+
narrow: [0, 0, "Narrowfence", "Narrowfence", "nawabari"],
291292
nawabari: [1, 0, "なわばり", "Nawabari", "nawabari"],
292293
news: [0, 0, "NEWS", "NEWS", "toichika"],
293294
nibunnogo: [0, 0, "ニブンノゴ", "Nibun-nogo", "lightshadow"],

src/res/failcode.en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"bkNoNum.kaero": "An area has no letters.",
162162
"bkNoNum.kramma": "An area has no marks.",
163163
"bkNoNum.nanro": "There is an empty room.",
164+
"bkNoNum.narrow": "A region has no symbols.",
164165
"bkNoNum.nawabari": "A room has no numbers.",
165166
"bkNoNum.nikoji": "An area has no letter.",
166167
"bkNoNum.nurikabe": "An area of unshaded cells has no numbers.",
@@ -208,6 +209,7 @@
208209
"bkNumGe2.fillmat": "A tatami has more than one number.",
209210
"bkNumGe2.hanare": "A room has more than one number.",
210211
"bkNumGe2.lohkous": "There is an area with more than one clue.",
212+
"bkNumGe2.narrow": "A region has more than one symbol.",
211213
"bkNumGe2.nawabari": "A room has more than one number.",
212214
"bkNumGe2.nikoji": "An area has multiple letters.",
213215
"bkNumGe2.nurikabe": "An area of unshaded cells has more than one number.",
@@ -240,8 +242,9 @@
240242
"bkPlNum": "A block has two or more kinds of number.",
241243
"bkPlStar.tentaisho": "A block has two or more stars.",
242244
"bkPluralShade.parquet": "A region has multiple shaded tiles.",
243-
"bkRect.cbblock": "A block is rectangle.",
245+
"bkRect": "A block is rectangle.",
244246
"bkSameNumGt2.kazunori": "The room has three or more same numbers.",
247+
"bkSameShape.narrow": "Two regions with the same symbol have the same shape.",
245248
"bkSameTouch.zabajaba": "Two blocks of the same shape and orientation are adjacent.",
246249
"bkSameTouch": "Two areas of the same shape and orientation are adjacent.",
247250
"bkSCGe2.dosufuwa": "An area has two or more iron balls.",
@@ -788,6 +791,7 @@
788791
"nmRange.sananko": "A number is larger than 3.",
789792
"nmRange.trainstations": "A number is out of range.",
790793
"nmSame2x2.kazunori": "There is a 2x2 block of the same number.",
794+
"nmSame2x2.narrow": "A 2x2 block of cells belong to regions with the same symbol.",
791795
"nmSame2x2.snakepit": "A snake loops back on itself.",
792796
"nmShade5Ne.lookair": "The number is not equal to the number of shaded cells in the cell and the four adjacent cells.",
793797
"nmShadeDiagNe.context": "The number of shaded cells diagonally adjacent to a shaded number is not correct.",

src/res/failcode.ja.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"bkPlNum": "複数種類の数字が入っているブロックがあります。",
181181
"bkPlStar.tentaisho": "星が複数含まれる領域があります。",
182182
"bkPluralShade.parquet": "複数のタイルが黒く塗られている領域があります。",
183-
"bkRect.cbblock": "ブロックが四角形になっています。",
183+
"bkRect": "ブロックが四角形になっています。",
184184
"bkSameNumGt2.kazunori": "部屋に同じ数字が3つ以上入っています。",
185185
"bkSameTouch": "向きも形も同じブロックが接しています。",
186186
"bkSCGe2.dosufuwa": "1つの領域に鉄球が複数入っています。",

src/variety/nawabari.js

Lines changed: 147 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
} else {
88
pzpr.classmgr.makeCustom(pidlist, classbase);
99
}
10-
})(["nawabari", "fourcells", "fivecells", "heteromino", "subomino"], {
10+
})(["nawabari", "fourcells", "fivecells", "heteromino", "subomino", "narrow"], {
1111
//---------------------------------------------------------
1212
// マウス入力系
1313
MouseEvent: {
@@ -29,7 +29,7 @@
2929
this.inputempty();
3030
}
3131
},
32-
"MouseEvent@fourcells,fivecells,subomino": {
32+
"MouseEvent@fourcells,fivecells,subomino,narrow": {
3333
inputModes: {
3434
edit: ["empty", "number", "clear"],
3535
play: ["border", "subline"]
@@ -90,6 +90,10 @@
9090
maxnum: 3,
9191
minnum: 0
9292
},
93+
"Cell@narrow": {
94+
maxnum: 4,
95+
disInputHatena: true
96+
},
9397
"Cell@subomino": {
9498
maxnum: function() {
9599
return this.board.cols * this.board.rows;
@@ -187,6 +191,17 @@
187191
});
188192
}
189193
},
194+
"AreaRoomGraph@narrow": {
195+
setExtraData: function(component) {
196+
var clist = (component.clist = new this.klass.CellList(
197+
component.getnodeobjs()
198+
));
199+
var numlist = clist.filter(function(cell) {
200+
return cell.isNum();
201+
});
202+
component.num = numlist.length === 1 ? numlist[0].getNum() : -1;
203+
}
204+
},
190205

191206
//---------------------------------------------------------
192207
// 画像表示系
@@ -265,6 +280,60 @@
265280
}
266281
},
267282

283+
"Graphic@narrow": {
284+
drawQuesNumbers: function() {
285+
var g = this.vinc("cell_mark", "auto");
286+
287+
g.lineWidth = Math.max(this.cw / 18, 2);
288+
var rsize = this.cw * 0.3;
289+
var clist = this.range.cells;
290+
for (var i = 0; i < clist.length; i++) {
291+
var cell = clist[i];
292+
293+
g.vid = "c_mk_" + cell.id;
294+
g.strokeStyle = this.getQuesNumberColor(cell);
295+
var px = cell.bx * this.bw,
296+
py = cell.by * this.bh;
297+
switch (cell.getNum()) {
298+
case 1:
299+
g.strokeCircle(px, py, rsize);
300+
break;
301+
case 2:
302+
g.beginPath();
303+
g.moveTo(px - rsize, py);
304+
g.lineTo(px + rsize, py);
305+
g.moveTo(px, py - rsize);
306+
g.lineTo(px, py + rsize);
307+
g.stroke();
308+
break;
309+
case 3:
310+
g.strokeCross(px, py, rsize);
311+
break;
312+
case 4:
313+
g.beginPath();
314+
g.setOffsetLinePath(
315+
px,
316+
py,
317+
0,
318+
-rsize,
319+
rsize,
320+
0,
321+
0,
322+
rsize,
323+
-rsize,
324+
0,
325+
true
326+
);
327+
g.stroke();
328+
break;
329+
default:
330+
g.vhide();
331+
break;
332+
}
333+
}
334+
}
335+
},
336+
268337
//---------------------------------------------------------
269338
// URLエンコード/デコード処理
270339
Encode: {
@@ -341,7 +410,7 @@
341410
this.outbstr += cm;
342411
}
343412
},
344-
"Encode@subomino": {
413+
"Encode@subomino,narrow": {
345414
decodePzpr: function(type) {
346415
this.decodeNumber16();
347416
this.decodeEmpty();
@@ -395,11 +464,14 @@
395464
"checkTouchDifferent@heteromino",
396465
"checkLessThreeCells@heteromino",
397466
"checkRoomRect@nawabari",
398-
"checkNoNumber@nawabari",
399-
"checkDoubleNumber@nawabari",
467+
"checkRoom2x2@narrow",
468+
"checkRoomIdentical@narrow",
469+
"checkNoNumber@nawabari,narrow",
470+
"checkRoomNotRect@narrow",
471+
"checkDoubleNumber@nawabari,narrow",
400472
"checkOverFourCells@fourcells",
401473
"checkOverFiveCells@fivecells",
402-
"checkdir4BorderAns@!heteromino",
474+
"checkdir4BorderAns@!heteromino,!narrow",
403475
"checkBorderDeadend+",
404476
"checkLessFourCells@fourcells",
405477
"checkLessFiveCells@fivecells"
@@ -570,5 +642,74 @@
570642
area.clist.seterr(1);
571643
}
572644
}
645+
},
646+
647+
"AnsCheck@narrow": {
648+
checkRoomNotRect: function() {
649+
this.checkAllArea(
650+
this.board.roommgr,
651+
function(w, h, a, n) {
652+
return w * h !== a;
653+
},
654+
"bkRect"
655+
);
656+
},
657+
658+
checkRoom2x2: function() {
659+
var bd = this.board;
660+
allloop: for (var c = 0; c < bd.cell.length; c++) {
661+
var cell = bd.cell[c],
662+
bx = cell.bx,
663+
by = cell.by;
664+
if (bx >= bd.maxbx - 1 || by >= bd.maxby - 1) {
665+
continue;
666+
}
667+
668+
var clist = bd.cellinside(bx, by, bx + 2, by + 2);
669+
if (!clist[0].room || clist[0].room.num <= 0) {
670+
continue;
671+
}
672+
for (var i = 1; i < 4; i++) {
673+
if (!clist[i].room || clist[0].room.num !== clist[i].room.num) {
674+
continue allloop;
675+
}
676+
}
677+
678+
this.failcode.add("nmSame2x2");
679+
if (this.checkOnly) {
680+
break;
681+
}
682+
clist.seterr(1);
683+
}
684+
},
685+
686+
checkRoomIdentical: function() {
687+
var found = {};
688+
689+
var rooms = this.board.roommgr.components;
690+
for (var i = 0; i < rooms.length; i++) {
691+
var room = rooms[i];
692+
if (room.num <= 0) {
693+
continue;
694+
}
695+
var tag = room.num + "";
696+
697+
if (!(tag in found)) {
698+
found[tag] = {};
699+
}
700+
701+
var shape = room.clist.getBlockShapes().canon;
702+
if (!(shape in found[tag])) {
703+
found[tag][shape] = room;
704+
} else {
705+
this.failcode.add("bkSameShape");
706+
if (this.checkOnly) {
707+
return;
708+
}
709+
found[tag][shape].clist.seterr(1);
710+
room.clist.seterr(1);
711+
}
712+
}
713+
}
573714
}
574715
});

test/script/narrow.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* narrow.js */
2+
3+
ui.debug.addDebugData("narrow", {
4+
url: "5/5/3i2g3i1q2h",
5+
failcheck: [
6+
[
7+
"nmSame2x2",
8+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /1 . . . . /. . . . . /. . 2 . . /0 0 0 0 1 0 /0 1 1 1 1 0 /0 1 1 0 0 0 /0 1 0 0 1 0 /0 0 1 0 0 0 /0 0 0 0 0 /0 1 1 0 0 /1 0 0 1 0 /0 0 1 1 1 /0 1 1 1 0 /0 0 0 0 0 /"
9+
],
10+
[
11+
"nmSame2x2",
12+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /1 . . . . /. . . . . /. . 2 . . /0 0 0 0 1 0 /0 1 1 1 1 0 /0 1 1 0 0 0 /0 1 0 1 0 0 /0 0 1 0 0 0 /0 0 0 0 0 /1 1 1 0 0 /0 0 0 1 0 /0 0 1 1 1 /0 1 1 0 0 /0 0 0 0 0 /"
13+
],
14+
[
15+
"bkSameShape",
16+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /1 . . . . /. . . . . /. . 2 . . /0 0 1 0 0 0 /0 0 0 0 1 0 /0 1 0 0 0 0 /0 1 0 0 1 0 /0 0 1 0 0 0 /0 0 0 0 0 /0 0 1 1 0 /1 0 0 0 1 /0 0 0 0 1 /0 1 1 1 0 /0 0 0 0 0 /"
17+
],
18+
[
19+
"bkNoNum",
20+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /. . . . . /. . . . . /. . 1 . . /0 0 0 0 1 0 /0 1 1 1 1 0 /0 1 1 0 1 0 /0 1 0 1 0 0 /0 0 0 0 0 0 /0 0 0 0 0 /1 1 1 0 0 /0 0 0 1 0 /0 0 1 1 0 /0 1 1 1 1 /0 0 0 0 0 /"
21+
],
22+
[
23+
"bkRect",
24+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /1 . . . . /. . . . . /. . 2 . . /0 0 0 1 0 0 /0 1 1 0 1 0 /0 1 0 1 1 0 /0 0 0 0 1 0 /0 1 0 0 0 0 /0 0 0 0 0 /1 1 1 1 0 /0 0 1 0 1 /0 1 1 0 0 /0 1 1 1 0 /0 0 0 0 0 /"
25+
],
26+
[
27+
"bkNumGe2",
28+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /1 . . . . /. . . . . /. . 2 . . /0 0 0 0 1 0 /0 1 1 1 1 0 /0 1 1 0 0 0 /0 1 0 1 1 0 /0 0 0 0 0 0 /0 0 0 0 0 /1 1 1 0 0 /0 0 0 1 0 /0 0 1 1 0 /0 1 1 0 1 /0 0 0 0 0 /"
29+
],
30+
[
31+
null,
32+
"pzprv3/narrow/5/5/3 . . . 2 /. 3 . . . /1 . . . . /. . . . . /. . 2 . . /0 0 0 0 1 0 /0 1 1 1 1 0 /0 1 1 0 0 0 /0 1 0 0 1 0 /0 0 1 0 0 0 /0 0 0 0 0 /1 1 1 0 0 /0 0 0 1 0 /0 0 1 1 1 /0 1 1 1 0 /0 0 0 0 0 /"
33+
]
34+
]
35+
});

0 commit comments

Comments
 (0)