Skip to content

Commit 0c18d2e

Browse files
authored
Add Tetro Chain-CTB
2 parents 6aa6cad + d228923 commit 0c18d2e

File tree

8 files changed

+151
-9
lines changed

8 files changed

+151
-9
lines changed

src-ui/img/tetroctb.png

134 Bytes
Loading

src-ui/js/ui/KeyPopup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ ui.keypopup = {
248248
bhaibahan: [10, 0],
249249
edamame: [4, 0],
250250
heavydots: [10, 0],
251-
marutaring: [10, 0]
251+
marutaring: [10, 0],
252+
tetroctb: [10, 0]
252253
},
253254

254255
//---------------------------------------------------------------------------

src-ui/js/ui/Misc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ function toBGimage(pid) {
234234
"teri",
235235
"tetrochain",
236236
"tetrochaink",
237+
"tetroctb",
237238
"tetrominous",
238239
"tilecity",
239240
"timebomb",

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
100100
<li data-pid="tilecity"></li>
101101
<li data-pid="nuritwin"></li>
102102
<li data-pid="marutaring"></li>
103+
<li data-pid="tetroctb"></li>
103104
</ul>
104105
</div>
105106
<div class="lists blocks">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@
457457
teri: [0, 0, "テリトリー", "Territory", "kurodoko"],
458458
tetrochain: [0, 0, "テトロチェーンY", "Tetro Chain-Y"],
459459
tetrochaink: [0, 0, "テトロチェーンK", "Tetro Chain-K", "kurarin"],
460+
tetroctb: [0, 0, "テトロチェーンCTB", "Tetro Chain-CTB", "shimaguni"],
460461
tetrominous: [0, 0, "Tetrominous", "Tetrominous", "fillomino"],
461462
tilecity: [0, 0, "タイルシティー", "Tile City"],
462463
tilepaint: [1, 0, "タイルペイント", "Tilepaint"],

src/res/failcode.en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"bkMSGe2.nondango": "An area has two or more shaded circles.",
152152
"bkMSPassedGt2.moonsun": "A line passes the marks of the moon for two rooms in a row.",
153153
"bkMUPassedGt2.moonsun": "A line passes the marks of the sun for two rooms in a row.",
154+
"bkNoBorder.tetroctb": "A block does not cross a region border.",
154155
"bkNoChain.chainedb": "A block is not diagonally adjacent to another block.",
155156
"bkNoChain.mrtile": "A block is not diagonally adjacent to another identical block.",
156157
"bkNoChain.sendai": "A city is not adjacent to another city with the same shape and orientation.",

src/variety/shimaguni.js

Lines changed: 105 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"cocktail",
1818
"martini",
1919
"nuritwin",
20-
"marutaring"
20+
"marutaring",
21+
"tetroctb"
2122
],
2223
{
2324
//---------------------------------------------------------
@@ -37,13 +38,13 @@
3738
play: ["shade", "unshade", "number"]
3839
}
3940
},
40-
"MouseEvent@cocktail,nuritwin,marutaring": {
41+
"MouseEvent@cocktail,nuritwin,marutaring,tetroctb": {
4142
inputModes: {
4243
edit: ["border", "number", "clear", "info-blk"],
4344
play: ["shade", "unshade", "info-blk"]
4445
}
4546
},
46-
"MouseEvent@cocktail,martini#2": {
47+
"MouseEvent@cocktail,martini,tetroctb#2": {
4748
dispInfoBlk: function() {
4849
var cell = this.getcell();
4950
this.mousereset();
@@ -123,7 +124,7 @@
123124
enableSubNumberArray: true,
124125
disableAnum: true
125126
},
126-
"Cell@chocona,hinge,heyablock,cocktail": {
127+
"Cell@chocona,hinge,heyablock,cocktail,tetroctb": {
127128
minnum: 0
128129
},
129130
"Cell@martini": {
@@ -182,7 +183,7 @@
182183
Board: {
183184
hasborder: 1
184185
},
185-
"Board@shimaguni,stostone,heyablock,cocktail,martini,nuritwin,marutaring": {
186+
"Board@shimaguni,stostone,heyablock,cocktail,martini,nuritwin,marutaring,tetroctb": {
186187
addExtraInfo: function() {
187188
this.stonegraph = this.addInfoList(this.klass.AreaStoneGraph);
188189
}
@@ -301,7 +302,7 @@
301302
}
302303
},
303304

304-
"AreaShadeGraph@chocona": {
305+
"AreaShadeGraph@chocona,tetroctb": {
305306
enabled: true
306307
},
307308
"AreaShadeGraph@nuritwin,marutaring": {
@@ -316,7 +317,7 @@
316317
component.hinge = null;
317318
}
318319
},
319-
"AreaStoneGraph:AreaShadeGraph@shimaguni,stostone,heyablock,cocktail,martini,nuritwin,marutaring": {
320+
"AreaStoneGraph:AreaShadeGraph@shimaguni,stostone,heyablock,cocktail,martini,nuritwin,marutaring,tetroctb": {
320321
// Same as LITS AreaTetrominoGraph
321322
enabled: true,
322323
relation: { "cell.qans": "node", "border.ques": "separator" },
@@ -356,7 +357,7 @@
356357
"AreaRoomGraph@martini": {
357358
hastop: false
358359
},
359-
"AreaShade8Graph@cocktail,martini": {
360+
"AreaShade8Graph@cocktail,martini,tetroctb": {
360361
enabled: true
361362
},
362363

@@ -647,6 +648,19 @@
647648
"checkShadeDeadEnd"
648649
]
649650
},
651+
"AnsCheck@tetroctb#1": {
652+
checklist: [
653+
"checkShadeCellExist+",
654+
"checkOverShadeCell",
655+
"checkAdjacentShapes",
656+
"checkUnderShadeCell",
657+
658+
"checkShadeCellCount",
659+
"checkBlockHasBorder",
660+
"checkConnect8Shade",
661+
"doneShadingDecided"
662+
]
663+
},
650664
"AnsCheck@shimaguni,stostone,heyablock,cocktail,martini": {
651665
checkSideAreaShadeCell: function() {
652666
this.checkSideAreaCell(
@@ -1055,6 +1069,89 @@
10551069
);
10561070
}
10571071
},
1072+
"AnsCheck@tetroctb": {
1073+
checkOverShadeCell: function() {
1074+
this.checkAllArea(
1075+
this.board.sblkmgr,
1076+
function(w, h, a, n) {
1077+
return a <= 4;
1078+
},
1079+
"csGt4"
1080+
);
1081+
},
1082+
checkUnderShadeCell: function() {
1083+
this.checkAllArea(
1084+
this.board.sblkmgr,
1085+
function(w, h, a, n) {
1086+
return a >= 4;
1087+
},
1088+
"csLt4"
1089+
);
1090+
},
1091+
checkAdjacentShapes: function() {
1092+
var bd = this.board;
1093+
for (var c = 0; c < bd.cell.length; c++) {
1094+
var cell = bd.cell[c];
1095+
if (cell.bx === bd.maxbx - 1 || cell.by === bd.maxby - 1) {
1096+
continue;
1097+
}
1098+
1099+
var i,
1100+
adc = cell.adjacent;
1101+
var cells = [
1102+
[cell, adc.right.adjacent.bottom],
1103+
[adc.right, adc.bottom]
1104+
];
1105+
for (i = 0; i < 2; i++) {
1106+
if (cells[i][0].isShade() && cells[i][1].isShade()) {
1107+
break;
1108+
}
1109+
}
1110+
if (i === 2) {
1111+
continue;
1112+
}
1113+
1114+
var block1 = cells[i][0].sblk,
1115+
block2 = cells[i][1].sblk;
1116+
if (
1117+
block1 === block2 ||
1118+
block1.clist.length !== 4 ||
1119+
this.isDifferentShapeBlock(block1, block2)
1120+
) {
1121+
continue;
1122+
}
1123+
1124+
this.failcode.add("bsSameShape");
1125+
if (this.checkOnly) {
1126+
break;
1127+
}
1128+
block1.clist.seterr(1);
1129+
block2.clist.seterr(1);
1130+
}
1131+
},
1132+
checkBlockHasBorder: function() {
1133+
var areas = this.board.sblkmgr.components;
1134+
for (var id = 0; id < areas.length; id++) {
1135+
var area = areas[id],
1136+
clist = area.clist;
1137+
if (
1138+
clist.length < 4 ||
1139+
clist.length !== clist[0].stone.clist.length
1140+
) {
1141+
continue;
1142+
}
1143+
1144+
this.failcode.add("bkNoBorder");
1145+
if (this.checkOnly) {
1146+
break;
1147+
}
1148+
clist.seterr(1);
1149+
}
1150+
},
1151+
checkConnect8Shade: function() {
1152+
this.checkOneArea(this.board.sblk8mgr, "csDivide");
1153+
}
1154+
},
10581155

10591156
FailCode: {
10601157
bkShadeDivide: "bkShadeDivide",

test/script/tetroctb.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* tetroctb.js */
2+
3+
ui.debug.addDebugData("tetroctb", {
4+
url: "6/6/va3orecsuf6l31h2i101h11",
5+
failcheck: [
6+
[
7+
"brNoShade",
8+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /. . . . . . /. . . . . . /. . . . . . /. . . . . . /. . . . . . /. . . . . . /"
9+
],
10+
[
11+
"csGt4",
12+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /. . . . . . /. . . . . . /. . . . . . /# . . . . . /# # # # . . /. . . . . . /"
13+
],
14+
[
15+
"csLt4",
16+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /# # . . . . /# # . . . . /. . . . . . /# . . . . . /# # . . . . /. . . . . . /"
17+
],
18+
[
19+
"bsSameShape",
20+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /# # . # # # /# # . . . # /. . # # # . /# . . # . . /# # # . . # /. . . # # # /"
21+
],
22+
[
23+
"bkNoBorder",
24+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /# # . . # # /# # . # . # /. . # # . # /# . . # . . /# # # . # # /. . . # # . /"
25+
],
26+
[
27+
"csDivide",
28+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /# # . # # . /# # . . # . /. . . . # . /# . . . . . /# # # . # # /. . . # # . /"
29+
],
30+
[
31+
"bkShadeNe",
32+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /# # . . . . /# # . . . . /. . # # # . /# . . # . . /# # # . # # /. . . # # . /"
33+
],
34+
[
35+
null,
36+
"pzprv3/tetroctb/6/6/15/0 1 2 3 4 5 /0 0 3 3 4 4 /3 3 3 3 6 7 /8 9 3 3 3 3 /10 11 3 3 12 13 /10 10 3 14 12 12 /3 1 . . 2 . /. . . . . . /. . . . . . /1 0 . . . . /1 . . . . 1 /. . . 1 . . /# # + # # # /# # + + + # /+ + # # # + /# + + # + + /# # # + # # /+ + + # # + /"
37+
]
38+
],
39+
inputs: []
40+
});

0 commit comments

Comments
 (0)