Skip to content

Commit 829288a

Browse files
committed
Add Trizone
1 parent 19cc9d8 commit 829288a

7 files changed

Lines changed: 192 additions & 12 deletions

File tree

src-ui/js/ui/KeyPopup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ui.keypopup = {
4141
lookair: [5, 0],
4242
hebi: [5, 5],
4343
tawa: [6, 0],
44+
trizone: [6, 0],
4445
hashikake: [8, 0],
4546
tapa: [80, 0],
4647
tapaloop: [80, 0],

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
312312
<li data-pid="balloon"></li>
313313
<li data-pid="sendai"></li>
314314
<li data-pid="heavydots"></li>
315+
<li data-pid="trizone"></li>
315316
</ul>
316317
</div>
317318
<div class="lists divides">

src/puzzle/Config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@
428428
exec = pid === "lollipops" || pid === "magnets";
429429
break;
430430
case "patchwork_leftaux":
431-
exec = pid === "patchwork";
431+
exec = pid === "patchwork" || pid === "trizone";
432432
break;
433433
case "undefcell":
434434
exec =

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@
482482
trainstations: [0, 0, "Train Stations", "Train Stations"],
483483
tren: [0, 0, "パーキング", "Tren"],
484484
triplace: [0, 0, "トリプレイス", "Tri-place"],
485+
trizone: [0, 0, "Trizone", "Trizone", "lapaz"],
485486
tslither: [0, 0, "Touch Slitherlink", "Touch Slitherlink", "vslither"],
486487
turnaround: [0, 0, "ターンアラウンド", "Turnaround"],
487488
turnrun: [0, 0, "トツゲキループ", "Turn and Run", "trainstations"],

src/res/failcode.en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@
885885
"nmShadeNe.paintarea": "The number is not equal to the number of shaded cells in the four adjacent cells.",
886886
"nmShadeNe.retsurin": "The number is not equal to the amount of shaded cells in its row or column.",
887887
"nmShadeNe.tawa": "The number of shaded cells around a number is not correct.",
888+
"nmShadeNe.trizone": "The number of shaded cells around an area is not correct.",
888889
"nmShadeViewNe.canal": "A cell containing a clue number sees a different number of shaded cells in the four orthogonal directions.",
889890
"nmShapeNe": "A shape does not match the given letter.",
890891
"nmShootShadeNe1.kurochute": "There is not exactly one shaded cell at the given distance from the number.",

src/variety/lapaz.js

Lines changed: 127 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
//
2-
// パズル固有スクリプト部 あみぼー版 amibo.js
3-
//
41
(function(pidlist, classbase) {
52
if (typeof module === "object" && module.exports) {
63
module.exports = [pidlist, classbase];
74
} else {
85
pzpr.classmgr.makeCustom(pidlist, classbase);
96
}
10-
})(["lapaz"], {
7+
})(["lapaz", "trizone"], {
118
//---------------------------------------------------------
129
// マウス入力系
1310
MouseEvent: {
@@ -26,7 +23,18 @@
2623
this.inputdragcross();
2724
}
2825
} else if (this.mouseend && this.notInputted()) {
29-
this.inputcell();
26+
if (
27+
this.puzzle.getConfig("patchwork_leftaux") &&
28+
!this.getpos(0.25).oncell()
29+
) {
30+
var border = this.getborder();
31+
if (!border.isnull) {
32+
border.setQsub(border.qsub === 1 ? 0 : 1);
33+
border.draw();
34+
}
35+
} else {
36+
this.inputcell();
37+
}
3038
}
3139
} else if (this.puzzle.editmode) {
3240
if (this.mousestart) {
@@ -58,6 +66,12 @@
5866
}
5967
}
6068
},
69+
"MouseEvent@trizone": {
70+
inputModes: {
71+
edit: ["number", "empty", "clear"],
72+
play: ["border", "shade", "unshade", "subline"]
73+
}
74+
},
6175

6276
//---------------------------------------------------------
6377
// キーボード入力系
@@ -110,6 +124,9 @@
110124
return this.reldirbd(this.getdir(cell2, 2), 1);
111125
}
112126
},
127+
"Cell@trizone": {
128+
maxnum: 6
129+
},
113130
Border: {
114131
isGrid: function() {
115132
return (
@@ -157,6 +174,23 @@
157174
return !border.isBorder();
158175
}
159176
},
177+
"AreaRoomGraph@trizone": {
178+
setExtraData: function(component) {
179+
component.clist = new this.klass.CellList(component.getnodeobjs());
180+
181+
var set = new Set();
182+
183+
component.clist.each(function(cell) {
184+
for (var dir in cell.adjacent) {
185+
var adj = cell.adjacent[dir];
186+
if (!adj.isnull && adj.room !== component) {
187+
set.add(adj);
188+
}
189+
}
190+
});
191+
component.adjclist = new this.klass.CellList(Array.from(set));
192+
}
193+
},
160194
//---------------------------------------------------------
161195
// 画像表示系
162196
Graphic: {
@@ -172,6 +206,7 @@
172206

173207
this.drawValidDashedGrid();
174208
this.drawBorders();
209+
this.drawBorderQsubs();
175210

176211
this.drawQuesNumbers();
177212

@@ -269,10 +304,14 @@
269304
// 正解判定処理実行部
270305
AnsCheck: {
271306
checklist: [
272-
"checkNumberRegionSize",
307+
"checkNumberRegionSize@lapaz",
273308
"check1x1Shaded",
274309
"checkAdjacentShadeCell",
275-
"checkShadeCounts",
310+
"checkLessThreeCells@trizone",
311+
"checkShadeCounts@lapaz",
312+
"checkDoubleNumber@trizone",
313+
"checkNoNumber@trizone",
314+
"checkShadeAdjacentCount@trizone",
276315
"checkRegionSize"
277316
],
278317

@@ -290,21 +329,23 @@
290329

291330
checkRegionSize: function() {
292331
var areas = this.board.roommgr.components;
332+
var max = this.pid === "trizone" ? 3 : 2;
293333
for (var id = 0; id < areas.length; id++) {
294334
var area = areas[id];
295335

296-
if (area.clist.length <= 2) {
336+
if (area.clist.length <= max) {
297337
continue;
298338
}
299339

300-
this.failcode.add("bkSizeGt2");
340+
this.failcode.add(max === 3 ? "bkSizeGt3" : "bkSizeGt2");
301341
if (this.checkOnly) {
302342
break;
303343
}
304344
area.clist.seterr(1);
305345
}
306-
},
307-
346+
}
347+
},
348+
"AnsCheck@lapaz": {
308349
checkShadeCounts: function() {
309350
this.checkRowsColsPartly(
310351
this.isRowCount,
@@ -345,5 +386,80 @@
345386
}
346387
return true;
347388
}
389+
},
390+
"AnsCheck@trizone": {
391+
checkNoNumber: function() {
392+
var rooms = this.board.roommgr.components;
393+
for (var r = 0; r < rooms.length; r++) {
394+
var room = rooms[r],
395+
num = room.clist.getQnumCell().getNum();
396+
if (num !== -1 || room.clist.length !== 3) {
397+
continue;
398+
}
399+
400+
this.failcode.add("bkNoNum");
401+
if (this.checkOnly) {
402+
return;
403+
}
404+
room.clist.seterr(1);
405+
}
406+
},
407+
checkDoubleNumber: function() {
408+
var rooms = this.board.roommgr.components;
409+
for (var r = 0; r < rooms.length; r++) {
410+
var room = rooms[r];
411+
if (room.clist.length !== 3) {
412+
continue;
413+
}
414+
var num = room.clist.filter(function(cell) {
415+
return cell.isNum();
416+
}).length;
417+
if (num < 2) {
418+
continue;
419+
}
420+
421+
this.failcode.add("bkNumGe2");
422+
if (this.checkOnly) {
423+
return;
424+
}
425+
room.clist.seterr(1);
426+
}
427+
},
428+
checkLessThreeCells: function() {
429+
this.checkAllArea(
430+
this.board.roommgr,
431+
function(w, h, a, n) {
432+
return a !== 2;
433+
},
434+
"bkSizeLt3"
435+
);
436+
},
437+
checkShadeAdjacentCount: function() {
438+
var checkSingleError = !this.puzzle.getConfig("multierr");
439+
var rooms = this.board.roommgr.components;
440+
for (var r = 0; r < rooms.length; r++) {
441+
var room = rooms[r],
442+
num = room.clist.getQnumCell().getNum();
443+
if (num < 0 || room.clist.length !== 3) {
444+
continue;
445+
}
446+
447+
var actual = room.adjclist.filter(function(cell) {
448+
return cell.isShade();
449+
});
450+
451+
if (actual.length !== num) {
452+
this.failcode.add("nmShadeNe");
453+
if (this.checkOnly) {
454+
return;
455+
}
456+
room.clist.seterr(1);
457+
actual.seterr(1);
458+
if (checkSingleError) {
459+
return;
460+
}
461+
}
462+
}
463+
}
348464
}
349465
});

test/script/trizone.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* trizone.js */
2+
3+
ui.debug.addDebugData("trizone", {
4+
url: "6/6/22n2g2h4j1h2g1n00",
5+
failcheck: [
6+
[
7+
"bkSizeGt3",
8+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /1 0 0 1 0 /0 1 0 1 0 /0 0 0 1 0 /1 1 0 1 0 /1 1 0 1 0 /1 1 0 0 1 /0 1 0 1 0 0 /1 1 0 0 0 1 /0 0 1 0 0 0 /0 0 0 0 1 1 /0 0 1 1 1 0 /. . . . # . /. . # . . . /. # . . # . /. . . # . . /. . . . . . /. . . . . . /"
9+
],
10+
[
11+
"bkSizeLt3",
12+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 1 0 /1 0 0 1 0 /0 1 0 0 1 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 1 1 /0 1 1 0 1 1 /0 1 1 1 1 0 /. . . . . . /. . . . . . /. . . . . # /. . . # . . /. . . . . . /. . . . . . /"
13+
],
14+
[
15+
"bkUnshade",
16+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /1 0 0 1 0 /0 1 1 0 0 /1 1 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 1 1 1 0 0 /1 1 1 0 0 0 /0 1 0 0 0 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /. . . . . . /. . . . . . /. # . . . . /. . . . . . /. . . . . . /. . . . . . /"
17+
],
18+
[
19+
"csAdjacent",
20+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /1 0 0 1 0 /0 1 0 0 1 /0 0 0 1 1 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 1 0 1 0 0 /1 1 0 0 0 0 /0 0 0 0 1 0 /0 0 0 0 0 0 /0 0 0 0 0 0 /. . . . . # /. . # # . . /. # . . . . /. . . . . . /. . . . . . /. . . . . . /"
21+
],
22+
[
23+
"bkNoNum",
24+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 0 /0 1 0 1 0 /0 1 0 0 1 /0 0 0 0 0 0 /0 0 0 0 0 0 /0 0 0 1 0 0 /0 0 1 0 1 1 /0 0 1 1 1 0 /. . . . . . /. . . . . . /. . . . . . /. . . . . . /. . . . . . /. . . . . . /"
25+
],
26+
[
27+
"bkNumGe2",
28+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /0 0 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 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 /. . . # . . /# . . . . . /. . . . . . /. . . . . . /. . . . . . /. . . . . . /"
29+
],
30+
[
31+
"nmShadeNe",
32+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /1 0 0 1 0 /0 1 1 1 0 /0 0 1 1 1 /0 1 1 1 0 /0 1 1 1 0 /0 1 0 0 1 /0 1 0 1 0 0 /1 1 0 0 0 1 /0 0 0 0 1 0 /0 1 0 0 1 1 /0 0 1 1 1 0 /. . . . # . /. . # . . . /. # . . # . /. . . . . . /# . . # . . /. . . . . . /"
33+
],
34+
[
35+
null,
36+
"pzprv3/trizone/6/6/2 2 . . . . /. . . . 2 . /2 . . 4 . . /. . 1 . . 2 /. 1 . . . . /. . . . 0 0 /1 0 0 1 0 /0 1 0 1 0 /0 0 0 1 0 /0 1 0 1 0 /0 1 0 1 0 /0 1 0 0 1 /0 1 0 1 0 0 /1 1 0 0 0 1 /0 0 1 0 0 0 /1 1 0 0 1 1 /0 0 1 1 1 0 /+ + + + # + /+ + # + + + /+ # + + # + /+ + + # + + /# + + + + + /+ + + + + + /"
37+
]
38+
],
39+
inputs: [
40+
{
41+
input: [
42+
"newboard,3,3",
43+
"editmode",
44+
"key,6",
45+
"playmode",
46+
"mouse,left,1,5",
47+
"mouse,left,3,3",
48+
"mouse,left,4,0,4,2",
49+
"mouse,right,1,1,5,1"
50+
],
51+
result:
52+
"pzprv3/trizone/3/3/6 . . /. . . /. . . /0 1 /0 0 /0 0 /0 0 0 /0 0 0 /+ + + /. # . /# . . /"
53+
},
54+
{
55+
input: ["mouse,left,4,5"],
56+
result:
57+
"pzprv3/trizone/3/3/6 . . /. . . /. . . /0 1 /0 0 /0 -1 /0 0 0 /0 0 0 /+ + + /. # . /# . . /"
58+
}
59+
]
60+
});

0 commit comments

Comments
 (0)