Skip to content

Commit 97ecb80

Browse files
committed
Add Nuritwin
1 parent 1bab081 commit 97ecb80

File tree

6 files changed

+126
-6
lines changed

6 files changed

+126
-6
lines changed

src-ui/js/ui/KeyPopup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ ui.keypopup = {
220220
balloon: [10, 0],
221221
tilecity: [10, 0],
222222
orbital: [124, 0],
223-
outofsight: [132, 0]
223+
outofsight: [132, 0],
224+
nuritwin: [10, 0]
224225
},
225226

226227
//---------------------------------------------------------------------------

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
9292
<li data-pid="mannequin"></li>
9393
<li data-pid="kuromenbun"></li>
9494
<li data-pid="tilecity"></li>
95+
<li data-pid="nuritwin"></li>
9596
</ul>
9697
</div>
9798
<div class="lists blocks">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@
306306
nurikabe: [0, 1, "ぬりかべ", "Nurikabe", "nurikabe"],
307307
nurimaze: [0, 0, "ぬりめいず", "Nuri-Maze", "nurimaze"],
308308
nurimisaki: [0, 0, "ぬりみさき", "Nurimisaki", "kurodoko"],
309+
nuritwin: [0, 0, "ぬりツイン", "Nuritwin", "shimaguni"],
309310
nuriuzu: [0, 0, "ぬりうず", "Nuri-uzu", "tentaisho"],
310311
ovotovata: [0, 0, "Ovotovata", "Ovotovata", "country"],
311312
oneroom: [0, 0, "ワンルームワンドア", "One Room One Door", "heyawake"],

src/res/failcode.en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"bkDifferentShape.dbchoco": "The two shapes inside a block are different.",
9898
"bkDifferentShape.kuroclone": "Two units in an area have different shapes.",
9999
"bkDifferentShape.nikoji": "Two areas with equal letters have different shapes.",
100+
"bkDifferentShape.nuritwin": "The two blocks inside an area have different sizes.",
100101
"bkDivide": "The unused cells are divided.",
101102
"bkDoubleBn.yosenabe": "There is two or more numbers in a crock.",
102103
"bkDupNum.hakoiri": "A box has duplicate shapes.",
@@ -308,6 +309,7 @@
308309
"bkSumNeBn.yosenabe": "Sum of filling is not equal to a crock.",
309310
"bkUCGe2.dosufuwa": "An area has two or more balloons.",
310311
"bkUnitNe2.kuroclone": "There is an area without exactly two units.",
312+
"bkUnitNe2.nuritwin": "An area doesn't have exactly two blocks.",
311313
"bkUnknown.lohkous": "A room has a segment of invalid length.",
312314
"bkUnshade.lapaz": "A 1x1 region is unshaded.",
313315
"bkUnshadeConsecGt3": "There is a line of consecutive unshaded cells that goes through 2 region borders.",

src/variety/shimaguni.js

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//
22
// パズル固有スクリプト部 島国・チョコナ・ストストーン版 shimaguni.js
33
//
4+
/* global Set:false */
45
(function(pidlist, classbase) {
56
if (typeof module === "object" && module.exports) {
67
module.exports = [pidlist, classbase];
@@ -15,7 +16,8 @@
1516
"hinge",
1617
"heyablock",
1718
"cocktail",
18-
"martini"
19+
"martini",
20+
"nuritwin"
1921
],
2022
{
2123
//---------------------------------------------------------
@@ -35,7 +37,7 @@
3537
play: ["shade", "unshade", "number"]
3638
}
3739
},
38-
"MouseEvent@cocktail": {
40+
"MouseEvent@cocktail,nuritwin": {
3941
inputModes: {
4042
edit: ["border", "number", "clear", "info-blk"],
4143
play: ["shade", "unshade", "info-blk"]
@@ -111,6 +113,12 @@
111113
return Math.min(999, this.room.clist.length);
112114
}
113115
},
116+
"Cell@nuritwin": {
117+
maxnum: function() {
118+
var half = (this.room.clist.length - 1) >> 1;
119+
return Math.max(1, Math.min(999, half));
120+
}
121+
},
114122
"Cell@shimaguni": {
115123
enableSubNumberArray: true,
116124
disableAnum: true
@@ -174,7 +182,7 @@
174182
Board: {
175183
hasborder: 1
176184
},
177-
"Board@shimaguni,stostone,heyablock,cocktail,martini": {
185+
"Board@shimaguni,stostone,heyablock,cocktail,martini,nuritwin": {
178186
addExtraInfo: function() {
179187
this.stonegraph = this.addInfoList(this.klass.AreaStoneGraph);
180188
if (this.pid === "cocktail" || this.pid === "martini") {
@@ -296,7 +304,7 @@
296304
}
297305
},
298306

299-
"AreaShadeGraph@chocona": {
307+
"AreaShadeGraph@chocona,nuritwin": {
300308
enabled: true
301309
},
302310
"AreaShadeGraph@hinge": {
@@ -307,7 +315,7 @@
307315
component.hinge = null;
308316
}
309317
},
310-
"AreaStoneGraph:AreaShadeGraph@shimaguni,stostone,heyablock,cocktail,martini": {
318+
"AreaStoneGraph:AreaShadeGraph@shimaguni,stostone,heyablock,cocktail,martini,nuritwin": {
311319
// Same as LITS AreaTetrominoGraph
312320
enabled: true,
313321
relation: { "cell.qans": "node", "border.ques": "separator" },
@@ -618,6 +626,17 @@
618626
"checkShadeCellCount"
619627
]
620628
},
629+
"AnsCheck@nuritwin#1": {
630+
checklist: [
631+
"check2x2ShadeCell",
632+
"checkShadeBlockSize",
633+
"checkSizesEqual",
634+
"checkTwoBlocks",
635+
"checkConnectShade",
636+
"checkNoShadeCellInArea",
637+
"doneShadingDecided"
638+
]
639+
},
621640
"AnsCheck@shimaguni,stostone,heyablock,cocktail,martini": {
622641
checkSideAreaShadeCell: function() {
623642
this.checkSideAreaCell(
@@ -926,6 +945,74 @@
926945
this.checkOneArea(this.board.sblk8mgr, "csDivide");
927946
}
928947
},
948+
"AnsCheck@nuritwin": {
949+
checkShadeBlockSize: function() {
950+
var blocks = this.board.stonegraph.components;
951+
for (var id = 0; id < blocks.length; id++) {
952+
var block = blocks[id];
953+
var room = block.clist[0].room;
954+
if (!room || !room.top.isValidNum()) {
955+
continue;
956+
}
957+
958+
if (block.clist.length !== room.top.getNum()) {
959+
this.failcode.add("bkSizeNe");
960+
if (this.checkOnly) {
961+
break;
962+
}
963+
room.clist.seterr(1);
964+
}
965+
}
966+
},
967+
checkSizesEqual: function() {
968+
var rooms = this.board.roommgr.components;
969+
for (var r = 0; r < rooms.length; r++) {
970+
var room = rooms[r];
971+
if (room.top.isValidNum()) {
972+
continue;
973+
}
974+
975+
var units = this.getUnits(room);
976+
if (units.length !== 2) {
977+
continue;
978+
}
979+
if (units[0].clist.length === units[1].clist.length) {
980+
continue;
981+
}
982+
983+
this.failcode.add("bkDifferentShape");
984+
if (this.checkOnly) {
985+
break;
986+
}
987+
room.clist.seterr(1);
988+
}
989+
},
990+
checkTwoBlocks: function() {
991+
var rooms = this.board.roommgr.components;
992+
for (var r = 0; r < rooms.length; r++) {
993+
var room = rooms[r];
994+
var units = this.getUnits(room);
995+
if (units.length === 0 || units.length === 2) {
996+
continue;
997+
}
998+
999+
this.failcode.add("bkUnitNe2");
1000+
if (this.checkOnly) {
1001+
break;
1002+
}
1003+
room.clist.seterr(1);
1004+
}
1005+
},
1006+
getUnits: function(room) {
1007+
var set = new Set();
1008+
room.clist.each(function(cell) {
1009+
if (cell.isShade()) {
1010+
set.add(cell.stone);
1011+
}
1012+
});
1013+
return Array.from(set);
1014+
}
1015+
},
9291016

9301017
FailCode: {
9311018
bkShadeDivide: "bkShadeDivide",

test/script/nuritwin.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* nuritwin.js */
2+
3+
ui.debug.addDebugData("nuritwin", {
4+
url: "5/5/08qi3u4632h",
5+
failcheck: [
6+
[
7+
"bkSizeNe",
8+
"pzprv3/nuritwin/5/5/4/0 0 0 0 0 /0 0 0 1 1 /2 2 2 3 1 /2 2 3 3 1 /2 2 2 1 1 /3 . . . . /. . . 2 . /. . . . . /. . . . . /. . . . . /# . # # . /# . . # # /# # # # . /. . # . . /# # # # # /"
9+
],
10+
[
11+
"bkUnitNe2",
12+
"pzprv3/nuritwin/5/5/4/0 0 0 0 0 /0 0 0 1 1 /2 2 2 3 1 /2 2 3 3 1 /2 2 2 1 1 /3 . . . . /. . . 2 . /. . . . . /. . . . . /. . . . . /# . # # # /# # . . # /. # # # # /. . . # . /. # # # # /"
13+
],
14+
[
15+
"bkDifferentShape",
16+
"pzprv3/nuritwin/5/5/4/0 0 0 0 0 /0 0 0 1 1 /2 2 2 3 1 /2 2 3 3 1 /2 2 2 1 1 /3 . . . . /. . . 2 . /. . . . . /. . . . . /. . . . . /# . # # # /# # . . # /. # # # # /# . # . . /# # # # # /"
17+
],
18+
[
19+
"csDivide",
20+
"pzprv3/nuritwin/5/5/4/0 0 0 0 0 /0 0 0 1 1 /2 2 2 3 1 /2 2 3 3 1 /2 2 2 1 1 /3 . . . . /. . . 2 . /. . . . . /. . . . . /. . . . . /# . # # # /# # . . # /# . . # # /# . # . . /. # # # # /"
21+
],
22+
[
23+
null,
24+
"pzprv3/nuritwin/5/5/4/0 0 0 0 0 /0 0 0 1 1 /2 2 2 3 1 /2 2 3 3 1 /2 2 2 1 1 /3 . . . . /. . . 2 . /. . . . . /. . . . . /. . . . . /# + # # # /# # + + # /+ # # # # /+ + # + + /+ # # # # /"
25+
]
26+
],
27+
inputs: []
28+
});

0 commit comments

Comments
 (0)