Skip to content

Commit b3749ca

Browse files
authored
Add Sansa Road
1 parent e0d38fe commit b3749ca

8 files changed

Lines changed: 190 additions & 6 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?sansaroad" target="_parent">Sansa Road サンサロード</a></li>
3637
<li><a href="/p?diamond" target="_parent">Diamond Chain</a></li>
3738
<li><a href="/p?tetrochaink" target="_parent">Tetro Chain-K テトロチェーンK</a></li>
3839
<li><a href="/p?bunnyhop" target="_parent">Bunnyhop</a></li>
3940
<li><a href="/p?sashikabe" target="_parent">Sashikabe</a></li>
4041
<li><a href="/p?blindrush" target="_parent">Blind Rush 猪突猛進</a></li>
4142
<li><a href="/p?cityspace" target="_parent">City Space</a></li>
42-
<li><a href="/p?numcity" target="_parent">Number City ナンバーシティ一</a></li>
4343
</ul>
4444
</main>
4545
</body>

src-ui/img/sansaroad.png

127 Bytes
Loading

src-ui/js/ui/Misc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ function toBGimage(pid) {
202202
"retsurin",
203203
"roundtrip",
204204
"sananko",
205+
"sansaroad",
205206
"sashikabe",
206207
"sashikazune",
207208
"satogaeri",

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
7070
<li data-pid="cityspace"></li>
7171
<li data-pid="sashikabe"></li>
7272
<li data-pid="tetrochaink"></li>
73+
<li data-pid="sansaroad"></li>
7374
</ul>
7475
</div>
7576
<div class="lists blocks">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@
380380
roma: [0, 0, "ろーま", "Roma", "", { alias: "rome" }],
381381
roundtrip: [0, 0, "Round Trip", "Round Trip"],
382382
sananko: [0, 0, "サンアンコー", "San-Anko", "kakuru"],
383+
sansaroad: [0, 0, "サンサロード", "Sansa Road", "kurarin"],
383384
sashikabe: [0, 0, "Sashikabe", "Sashikabe", "loute"],
384385
sashigane: [0, 0, "さしがね", "Sashigane", "loute"],
385386
sashikazune: [0, 0, "さしカズね", "Sashikazune", "loute"],

src/res/failcode.en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@
476476
"cuDivide": "The unshaded cells are divided.",
477477
"cuDivideRB": "The unshaded cells are divided.",
478478
"cuEndpoint.takoyaki": "An endpoint does not have a circle.",
479+
"cuLt2.sansaroad": "An empty cell is adjacent to less than 2 unshaded cells.",
480+
"cuLt3.sansaroad": "A triangle is adjacent to less than 3 unshaded cells.",
481+
"cuGt2.sansaroad": "An empty cell is adjacent to more than 2 unshaded cells.",
482+
"cuGt3.sansaroad": "A triangle is adjacent to more than 3 unshaded cells.",
479483
"cuLoop": "There is a loop of unshaded cells.",
480484
"cuLower.stostone": "Unshaded cells exist in the lower half of the board after the blocks have fallen.",
481485
"cuNoLine.icebarn": "The line doesn't pass all of the non-icy cell.",

src/variety/kurarin.js

Lines changed: 134 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
} else {
55
pzpr.classmgr.makeCustom(pidlist, classbase);
66
}
7-
})(["kurarin", "tetrochaink"], {
7+
})(["kurarin", "tetrochaink", "sansaroad"], {
88
//---------------------------------------------------------
99
// マウス入力系
1010
MouseEvent: {
@@ -73,15 +73,16 @@
7373
var dot = pos.getDot();
7474
if (dot !== null) {
7575
var qn = dot.getDot();
76+
var max = dot.piece.getmaxnum();
7677
if (this.btn === "left") {
77-
if (qn === 3) {
78+
if (qn === max) {
7879
dot.setDot(0);
7980
} else {
8081
dot.setDot(qn + 1);
8182
}
8283
} else if (this.btn === "right") {
8384
if (qn === 0) {
84-
dot.setDot(3);
85+
dot.setDot(max);
8586
} else {
8687
dot.setDot(qn - 1);
8788
}
@@ -114,6 +115,20 @@
114115
this.puzzle.redraw();
115116
}
116117
},
118+
"MouseEvent@sansaroad": {
119+
inputModes: {
120+
edit: ["mark-triangle"],
121+
play: ["shade", "unshade"]
122+
},
123+
mouseinput_other: function() {
124+
if (this.inputMode === "mark-triangle") {
125+
this.inputFixedNumber(1);
126+
}
127+
},
128+
mouseinputAutoPlay: function() {
129+
this.inputShade();
130+
}
131+
},
117132

118133
//---------------------------------------------------------
119134
// キーボード入力系
@@ -130,9 +145,9 @@
130145
var dot = this.cursor.getDot();
131146
if (dot !== null) {
132147
var num = +ca;
133-
if (num >= 0 && num <= 3) {
148+
if (num >= 0 && num <= dot.piece.getmaxnum()) {
134149
dot.setDot(num);
135-
} else if (ca === " " || ca === "-") {
150+
} else if (ca === " " || ca === "-" || ca === "BS") {
136151
dot.setDot(0);
137152
}
138153
dot.draw();
@@ -161,6 +176,19 @@
161176
return this.lcnt === 0 && this.qsub === 1;
162177
}
163178
},
179+
"Cell@sansaroad": {
180+
maxnum: 1,
181+
allowShade: function() {
182+
return this.qnum <= 0;
183+
},
184+
posthook: {
185+
qnum: function(val) {
186+
if (val >= 0) {
187+
this.setQans(0);
188+
}
189+
}
190+
}
191+
},
164192
Cross: {
165193
qnum: 0,
166194
minnum: 0,
@@ -205,6 +233,9 @@
205233
"AreaShade8Graph@tetrochaink": {
206234
enabled: true
207235
},
236+
"AreaUnshadeGraph@sansaroad": {
237+
enabled: true
238+
},
208239

209240
//---------------------------------------------------------
210241
// 画像表示系
@@ -218,6 +249,8 @@
218249
this.drawShadedCells();
219250
if (this.pid === "kurarin") {
220251
this.drawDotCells();
252+
} else if (this.pid === "sansaroad") {
253+
this.drawQuesMarks();
221254
}
222255
this.drawGrid();
223256

@@ -238,6 +271,10 @@
238271
},
239272

240273
getDotFillColor: function(dot) {
274+
if (this.pid === "sansaroad" && dot.piece.group === "cell") {
275+
return null;
276+
}
277+
241278
switch (dot.getDot()) {
242279
case 1:
243280
return this.quescolor;
@@ -250,6 +287,10 @@
250287
}
251288
},
252289
getDotOutlineColor: function(dot) {
290+
if (this.pid === "sansaroad" && dot.piece.group === "cell") {
291+
return null;
292+
}
293+
253294
if (dot.getDot() >= 1) {
254295
return dot.iserror() ? this.errcolor1 : this.quescolor;
255296
}
@@ -263,6 +304,43 @@
263304
"Graphic@tetrochaink": {
264305
bgcellcolor_func: "qsub1"
265306
},
307+
"Graphic@sansaroad": {
308+
bgcellcolor_func: "qsub1",
309+
drawQuesMarks: function() {
310+
var g = this.vinc("cell_mark", "auto", true);
311+
312+
var rsize = this.cw * 0.3,
313+
tsize = this.cw * 0.26;
314+
g.lineWidth = 2;
315+
316+
var clist = this.range.cells;
317+
for (var i = 0; i < clist.length; i++) {
318+
var cell = clist[i];
319+
var px = cell.bx * this.bw,
320+
py = cell.by * this.bh;
321+
g.strokeStyle = this.getQuesNumberColor(cell);
322+
323+
g.vid = "c_mk_" + cell.id;
324+
if (cell.qnum === 1) {
325+
g.beginPath();
326+
g.setOffsetLinePath(
327+
px,
328+
py,
329+
0,
330+
tsize,
331+
-rsize,
332+
-tsize,
333+
rsize,
334+
-tsize,
335+
true
336+
);
337+
g.stroke();
338+
} else {
339+
g.vhide();
340+
}
341+
}
342+
}
343+
},
266344

267345
//---------------------------------------------------------
268346
// URLエンコード/デコード処理
@@ -349,6 +427,10 @@
349427
continue;
350428
}
351429

430+
if (dot.piece.group === "cell" && this.pid === "sansaroad") {
431+
continue;
432+
}
433+
352434
var cells = dot.piece.dotCells();
353435
var shaded = cells.filter(function(cell) {
354436
return cell.isShade();
@@ -456,6 +538,53 @@
456538
}
457539
}
458540
},
541+
"AnsCheck@sansaroad": {
542+
checklist: [
543+
"checkConnectUnshade",
544+
"checkTriangleUnder",
545+
"checkEmptyUnder",
546+
"checkShadeWhite",
547+
"checkShadeBlack",
548+
"checkShadeGray",
549+
"checkTriangleOver",
550+
"checkEmptyOver",
551+
"check2x2UnshadeCell++",
552+
"doneShadingDecided"
553+
],
554+
checkTriangleUnder: function() {
555+
this.checkAdjacency(1, -1, "cuLt3");
556+
},
557+
checkEmptyUnder: function() {
558+
this.checkAdjacency(0, -1, "cuLt2");
559+
},
560+
checkTriangleOver: function() {
561+
this.checkAdjacency(1, +1, "cuGt3");
562+
},
563+
checkEmptyOver: function() {
564+
this.checkAdjacency(0, +1, "cuGt2");
565+
},
566+
567+
checkAdjacency: function(num, flag, code) {
568+
for (var c = 0; c < this.board.cell.length; c++) {
569+
var cell = this.board.cell[c];
570+
if (cell.isShade() || cell.qnum !== num) {
571+
continue;
572+
}
573+
var count = cell.countDir4Cell(function(cell2) {
574+
return cell2.isUnshade();
575+
});
576+
if ((flag < 0 && count >= 2 + num) || (flag > 0 && count <= 2 + num)) {
577+
continue;
578+
}
579+
580+
this.failcode.add(code);
581+
if (this.checkOnly) {
582+
break;
583+
}
584+
cell.seterr(1);
585+
}
586+
}
587+
},
459588
FailCode: {
460589
ceEmpty: "ceEmpty.yajilin"
461590
}

test/script/sansaroad.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* sansaroad.js */
2+
3+
ui.debug.addDebugData("sansaroad", {
4+
url: "5/5/h4qch8h4x1g",
5+
failcheck: [
6+
[
7+
"cuDivide",
8+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./....1..../........./........./........./.......1./. . . . . /. # . # . /. . . # . /# # . . . /. . # # # /"
9+
],
10+
[
11+
"cuLt2",
12+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./....1..../........./........./........./.......1./. . . . . /. # . # . /. . . # . /# # . # . /# # . # # /"
13+
],
14+
[
15+
"cuGt2",
16+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./....1..../........./........./........./.......1./. . . . . /. # . # . /. . . # . /. # . . . /. . . # # /"
17+
],
18+
[
19+
"cuLt3",
20+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./1...1..../........./........./........./.......1./. . . . # /. # # . # /. . . . # /. # . # # /. . . # # /"
21+
],
22+
[
23+
"cuGt3",
24+
"pzprv3/sansaroad/5/5/....1..../........./........./.3......./1...1..../........./........./........./.......1./. . . . . /. # . # . /. . . . . /. # . # # /. . . # # /"
25+
],
26+
[
27+
"cu2x2",
28+
"pzprv3/sansaroad/5/5/....1..../........./........./........./........./........./1......../........./.......1./. . . . . /. # . # . /. # . . . /. . # # # /. . # # # /"
29+
],
30+
[
31+
"csDotWhite",
32+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./........./........./....1..../........./.......1./. . . . . /. # . # . /. # . # . /. # . . . /. . . # # /"
33+
],
34+
[
35+
"csDotGray",
36+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./....1..../........./........./........./.......1./. . . . . /. # . # . /. . . . . /# # # # # /# # # # # /"
37+
],
38+
[
39+
"csDotBlack",
40+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./....1..../........./........./........./.......1./. . . . . /. # . # . /. . . # . /# # . # . /# # . . . /"
41+
],
42+
[
43+
null,
44+
"pzprv3/sansaroad/5/5/....1..../........./........./.3.....2./....1..../........./........./........./.......1./+ + + + + /+ # + # + /+ + + # + /# # + + + /# # # # # /"
45+
]
46+
],
47+
inputs: []
48+
});

0 commit comments

Comments
 (0)