Skip to content

Commit 69f5c3a

Browse files
authored
Add Distopia
1 parent 5ab4363 commit 69f5c3a

9 files changed

Lines changed: 139 additions & 16 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?distopia" target="_parent">Distopia</a></li>
3637
<li><a href="/p?uturns" target="_parent">U-Turns</a></li>
3738
<li><a href="/p?isowatari" target="_parent">Isowatari イソワタリ</a></li>
3839
<li><a href="/p?narrow" target="_parent">Narrowfence</a></li>
3940
<li><a href="/p?kurarin" target="_parent">Kurarin クラリン</a></li>
4041
<li><a href="/p?sumiwake" target="_parent">Sumiwake すみわけ</a></li>
4142
<li><a href="/p?wataridori" target="_parent">Wataridori わたりどり</a></li>
42-
<li><a href="/p?forestwalk" target="_parent">Forest Walk</a></li>
4343
</ul>
4444
</main>
4545
</body>

src-ui/js/ui/KeyPopup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ ui.keypopup = {
232232
kurarin: [133, 0],
233233
narrow: [134, 0],
234234
isowatari: [10, 0],
235-
uturns: [133, 0]
235+
uturns: [133, 0],
236+
distopia: [10, 0]
236237
},
237238

238239
//---------------------------------------------------------------------------

src-ui/js/ui/MenuConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
idname = "nuriuzu_connect";
118118
break;
119119
case "pentopia":
120+
case "distopia":
120121
idname = "pentopia_transparent";
121122
break;
122123
case "koburin":

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
394394
<li data-pid="zabajaba"></li>
395395
<li data-pid="yajirushi2"></li>
396396
<li data-pid="arrowflow"></li>
397+
<li data-pid="distopia"></li>
397398
</ul>
398399
</div>
399400
<div class="lists others">

src/puzzle/Config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@
485485
exec = pid === "balloon";
486486
break;
487487
case "pentopia_transparent":
488-
exec = pid === "pentopia";
488+
exec = pid === "pentopia" || pid === "distopia";
489489
break;
490490
case "koburin_minesweeper":
491491
exec = pid === "koburin";

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
dbchoco: [0, 0, "ダブルチョコ", "Double Choco", "cbblock"],
144144
detour: [0, 0, "Detour", "Detour", "country"],
145145
disloop: [0, 0, "Disorderly Loop", "Disorderly Loop", "tapaloop"],
146+
distopia: [0, 0, "Distopia", "Distopia", "statuepark"],
146147
dominion: [0, 0, "ドミニオン", "Dominion"],
147148
doppelblock: [0, 0, "Doppelblock", "Doppelblock", "doppelblock"],
148149
dosufuwa: [0, 0, "ドッスンフワリ", "Dosun-Fuwari"],

src/res/failcode.en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"arBlockLt2.evolmino": "The arrow passes through less than two blocks.",
2828
"arCountGt.arrowflow": "A number has too many arrows pointing towards it.",
2929
"arCountLt.arrowflow": "A number does not have enough arrows pointing towards it.",
30+
"arDistance.distopia": "A number is not equal to the sum of the closest distances.",
3031
"arDistance.toichika2": "A pair of numbers does not have the correct distance.",
3132
"arDistanceGt.myopia": "There is a line closer to a clue in an unmarked direction.",
3233
"arDistanceGt.pentopia": "There is a shaded cell closer to a clue in an unmarked direction.",
@@ -35,6 +36,7 @@
3536
"arInvalid.evolmino": "The arrow is invalid.",
3637
"arNoLine": "A line doesn't go through some arrows.",
3738
"arNoLineSeen": "There is no line in the direction of an arrow.",
39+
"arNoShade.distopia": "A number cannot see any shaded cells.",
3840
"arNoShade.pentopia": "There is no shaded cell in the direction of an arrow.",
3941
"arNotMax.makaro": "An arrow doesn't point out biggest number.",
4042
"arNotPtCnr.loute": "An arrow doesn't point at the corner of an area.",

src/variety/statuepark.js

Lines changed: 93 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"pentatouch",
1414
"kissing",
1515
"retroships",
16-
"regional-poly"
16+
"regional-poly",
17+
"distopia"
1718
];
1819
if (typeof module === "object" && module.exports) {
1920
module.exports = [pidlist, classbase];
@@ -154,6 +155,12 @@
154155
cell.setNum(newdir);
155156
}
156157
},
158+
"MouseEvent@distopia#1": {
159+
inputModes: {
160+
edit: ["number", "clear", "completion"],
161+
play: ["shade", "unshade", "clear", "completion"]
162+
}
163+
},
157164

158165
"MouseEvent@battleship#1": {
159166
inputModes: {
@@ -880,6 +887,18 @@
880887
}
881888
},
882889

890+
"Cell@distopia": {
891+
minnum: 0,
892+
maxnum: function() {
893+
var a = this.board.rows - 1,
894+
b = this.board.cols - 1;
895+
return Math.max(a, b, 2 * Math.min(a, b));
896+
},
897+
allowShade: function() {
898+
return this.puzzle.getConfig("pentopia_transparent") || this.qnum === -1;
899+
}
900+
},
901+
883902
"Cell@pentopia": {
884903
numberAsObject: true,
885904
maxnum: 15,
@@ -1167,6 +1186,8 @@
11671186
this.drawCrossMarks();
11681187
} else if (this.pid === "statuepark") {
11691188
this.drawCircles();
1189+
} else if (this.pid === "distopia") {
1190+
this.drawQuesNumbers();
11701191
} else if (this.pid === "pentopia") {
11711192
this.drawArrowCombinations();
11721193
this.drawHatenas();
@@ -1206,7 +1227,7 @@
12061227
}
12071228
},
12081229

1209-
"Graphic@pentopia": {
1230+
"Graphic@pentopia,distopia#1": {
12101231
enablebcolor: true,
12111232

12121233
shadecolor: "rgb(80, 80, 80)",
@@ -1217,8 +1238,9 @@
12171238
return cell.isShade() ? this.errbcolor1 : this.errcolor1;
12181239
}
12191240
return cell.isShade() ? "white" : this.quescolor;
1220-
},
1221-
1241+
}
1242+
},
1243+
"Graphic@pentopia": {
12221244
drawArrowCombinations: function() {
12231245
var g = this.vinc("cell_arrow");
12241246

@@ -1749,7 +1771,7 @@
17491771
this.encodePieceBank();
17501772
}
17511773
},
1752-
"Encode@pentopia,retroships": {
1774+
"Encode@pentopia,distopia,retroships": {
17531775
decodePzpr: function(type) {
17541776
this.puzzle.setConfig("pentopia_transparent", this.checkpflag("t"));
17551777
if (this.outbstr[0] !== "/") {
@@ -1873,7 +1895,7 @@
18731895
encodeConfig: function() {}
18741896
},
18751897

1876-
"FileIO@pentopia": {
1898+
"FileIO@pentopia,distopia": {
18771899
decodeConfig: function() {
18781900
this.decodeConfigFlag("t", "pentopia_transparent");
18791901
},
@@ -2052,7 +2074,7 @@
20522074
}
20532075
},
20542076

2055-
"AnsCheck@pentopia,battleship,retroships,pentatouch,regional-poly#1": {
2077+
"AnsCheck@pentopia,distopia,battleship,retroships,pentatouch,regional-poly#1": {
20562078
checkShadeDiagonal: function() {
20572079
var bd = this.board;
20582080
for (var c = 0; c < bd.cell.length; c++) {
@@ -2092,14 +2114,16 @@
20922114
}
20932115
},
20942116

2095-
"AnsCheck@pentopia": {
2117+
"AnsCheck@pentopia,distopia#1": {
20962118
checklist: [
20972119
"checkShadeOnArrow",
20982120
"checkBankPiecesAvailable",
20992121
"checkShadeDiagonal",
2100-
"checkShadeDirCloser",
2101-
"checkShadeDirUnequal",
2102-
"checkShadeDirExist",
2122+
"checkShadeDirCloser@pentopia",
2123+
"checkShadeDirUnequal@pentopia",
2124+
"checkShadeDirExist@pentopia",
2125+
"checkNumberEqual@distopia",
2126+
"checkNumberExist@distopia",
21032127
"checkBankPiecesInvalid+"
21042128
],
21052129

@@ -2121,7 +2145,10 @@
21212145

21222146
for (var c = 0; c < bd.cell.length; c++) {
21232147
var cell0 = bd.cell[c];
2124-
if (cell0.qnum <= 0) {
2148+
if (this.pid === "pentopia" && cell0.qnum <= 0) {
2149+
continue;
2150+
}
2151+
if (this.pid === "distopia" && !cell0.isValidNum()) {
21252152
continue;
21262153
}
21272154
var row = [cell0, -1, -1, -1, -1];
@@ -2143,7 +2170,9 @@
21432170
}
21442171

21452172
return (this._info.shadeDirs = ret);
2146-
},
2173+
}
2174+
},
2175+
"AnsCheck@pentopia": {
21472176
checkShadeDirExist: function() {
21482177
var clues = this.getShadeDirs();
21492178
for (var i in clues) {
@@ -2236,6 +2265,57 @@
22362265
}
22372266
}
22382267
},
2268+
"AnsCheck@distopia": {
2269+
checkNumberEqual: function() {
2270+
var clues = this.getShadeDirs();
2271+
for (var i in clues) {
2272+
var dist = this.board.cols * this.board.rows;
2273+
var count = 0;
2274+
2275+
for (var dir = 1; dir <= 4; dir++) {
2276+
var d = clues[i][dir];
2277+
if (d !== -1 && d < dist) {
2278+
count = 1;
2279+
dist = d;
2280+
} else if (d === dist) {
2281+
count++;
2282+
}
2283+
}
2284+
2285+
if (count > 0 && clues[i][0].qnum !== dist * count) {
2286+
this.failcode.add("arDistance");
2287+
if (this.checkOnly) {
2288+
return;
2289+
}
2290+
clues[i][0].seterr(1);
2291+
}
2292+
}
2293+
},
2294+
2295+
checkNumberExist: function() {
2296+
var clues = this.getShadeDirs();
2297+
for (var i in clues) {
2298+
if (clues[i][0].qnum <= 0) {
2299+
continue;
2300+
}
2301+
2302+
var found = false;
2303+
for (var dir = 1; dir <= 4 && !found; dir++) {
2304+
if (clues[i][dir] !== -1) {
2305+
found = true;
2306+
}
2307+
}
2308+
2309+
if (!found) {
2310+
this.failcode.add("arNoShade");
2311+
if (this.checkOnly) {
2312+
return;
2313+
}
2314+
clues[i][0].seterr(1);
2315+
}
2316+
}
2317+
}
2318+
},
22392319

22402320
"AnsCheck@battleship,retroships": {
22412321
checklist: [

test/script/distopia.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* distopia.js */
2+
3+
ui.debug.addDebugData("distopia", {
4+
url: "7/6/k4i2i25h6zh4g//t",
5+
failcheck: [
6+
[
7+
"csOnArrow",
8+
"pzprv3/distopia/6/7/t/. . . . . 4 . /. . 2 . . . 2 /5 . . 6 . . . /. . . . . . . /. . . . . . . /. . . . . 4 . /. . # # . . . /. # # . . . . /. . . . . . . /. . . . . . . /. . . . . . . /. . . . . . . /0 0 0 0 0 /"
9+
],
10+
[
11+
"bankGt",
12+
"pzprv3/distopia/6/7/t/. . . . . 4 . /. . 2 . . . 2 /5 . . 6 . . . /. . . . . . . /. . . . . . . /. . . . . 4 . /. # # # . . . /. # . . . . . /. . . . . # . /. . . . . # # /. # # # . . # /. . . # . . . /0 0 0 0 0 /"
13+
],
14+
[
15+
"shDiag",
16+
"pzprv3/distopia/6/7/t/. . . . . 4 . /. . 2 . . . 2 /5 . . 6 . . . /. . . . . . . /. . . . . . . /. . . . . 4 . /. # # # . . . /. # . . . . . /. . . . . # . /. . . . . # # /. . # # # . # /. . . # . . . /0 0 0 0 0 /"
17+
],
18+
[
19+
"arDistance",
20+
"pzprv3/distopia/6/7/t/. . . . . 4 . /. . 2 . . . 2 /5 . . 6 . . . /. . . . . . . /. . . . . . . /. . . . . 4 . /. # # # . . . /. # . . . # . /. . . . . # # /. . . . . . # /. # # # . . . /. . # . . . . /0 0 0 0 0 /"
21+
],
22+
[
23+
"arNoShade",
24+
"pzprv3/distopia/3/4/t/. . . . /. 2 . . /. . . 2 /# # # . /# . . . /. . . . /0 0 0 0 0 /",
25+
{ skiprules: true }
26+
],
27+
[
28+
"bankInvalid",
29+
"pzprv3/distopia/6/7/t/. . . . . 4 . /. . 2 . . . 2 /5 . . 6 . . . /. . . . . . . /. . . . . . . /. . . . . 4 . /. # # # . . . /. # . . . . . /. . . . . # . /. . . . . # # /. . . # . . # /. . . # . . . /0 0 0 0 0 /"
30+
],
31+
[
32+
null,
33+
"pzprv3/distopia/6/7/t/. . . . . 4 . /. . 2 . . . 2 /5 . . 6 . . . /. . . . . . . /. . . . . . . /. . . . . 4 . /+ # # # + + + /+ # + + + + + /+ + + + + # + /+ + + + + # # /+ + # # + + # /+ + # # + + + /0 0 0 0 0 /"
34+
]
35+
],
36+
inputs: []
37+
});

0 commit comments

Comments
 (0)