Skip to content

Commit 03c7425

Browse files
authored
Add Kuroshiro Loop
2 parents 4dcdcae + 5fe9aea commit 03c7425

10 files changed

Lines changed: 209 additions & 3 deletions

File tree

src-ui/img/bwloop.png

138 Bytes
Loading

src-ui/js/ui/MenuConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
case "roboticwalk":
176176
case "wataridori":
177177
case "bhaibahan":
178+
case "bwloop":
178179
idname = "loop_full";
179180
break;
180181
}

src-ui/js/ui/Misc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function toBGimage(pid) {
122122
"bramble",
123123
"brownies",
124124
"bunnyhop",
125+
"bwloop",
125126
"castle",
126127
"cbanana",
127128
"chainedb",

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
172172
<li data-pid="bhaibahan"></li>
173173
<li data-pid="roboticwalk"></li>
174174
<li data-pid="nuriloop"></li>
175+
<li data-pid="bwloop"></li>
175176
</ul>
176177
</div>
177178
<div class="lists loops">

src/puzzle/Config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@
547547
"morningwalk",
548548
"roboticwalk",
549549
"wataridori",
550-
"bhaibahan"
550+
"bhaibahan",
551+
"bwloop"
551552
].indexOf(pid) >= 0;
552553
break;
553554
default:

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@
495495
wataridori: [0, 0, "わたりどり", "Wataridori", "country"],
496496
waterwalk: [0, 0, "ウォーターウォーク", "Water Walk", "icewalk"],
497497
wblink: [0, 0, "シロクロリンク", "Shirokuro-link"],
498+
bwloop: [0, 0, "クロシロループ", "Kuroshiro Loop"],
498499
wittgen: [0, 0, "デスクプレース", "Wittgenstein Briquet", "kaidan"],
499500
yajikazu: [1, 0, "やじさんかずさん", "Yajisan-Kazusan"],
500501
yajilin: [

src/res/failcode.en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,13 @@
573573
"lbLoop.amibo": "There is a loop of bars.",
574574
"lbNotCrossEq.amibo": "A bar doesn't cross a bar whose length is the same.",
575575
"lcBalance.coffeemilk": "A group doesn't have an equal number of white and black circles.",
576-
"lcCurveGt1.ichimaga": "The number of curves is twice or more.",
576+
"lcCurveGt1": "The number of curves is twice or more.",
577577
"lcCurveGt2.kusabi": "A line turns more than twice.",
578578
"lcCurveLt2.kusabi": "A line turns less than twice.",
579579
"lcCurveNe.firefly": "The number of curves is different from a firefly's number.",
580580
"lcCurveNe.mintonette": "A number doesn't indicate the amount of turns taken by the path.",
581+
"lcCurveNe0.bwloop": "Two equal pearls aren't connected by a straight line.",
582+
"lcCurveNe1.bwloop": "Two different pearls don't have exactly one turn between them.",
581583
"lcDeadEnd": "There is a dead-end line.",
582584
"lcDivided.tjunction": "Not all T-junctions are connected.",
583585
"lcDivided": "All lines and numbers are not connected to each other.",

src/res/failcode.ja.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@
384384
"lbLenLt.amibo": "白丸から出る棒の長さが短いです。",
385385
"lbLoop.amibo": "棒で輪っかができています。",
386386
"lbNotCrossEq.amibo": "同じ長さの棒と交差していません。",
387-
"lcCurveGt1.ichimaga": "線が2回以上曲がっています。",
387+
"lcCurveGt1": "線が2回以上曲がっています。",
388388
"lcCurveGt2.kusabi": "線が2回以上曲がっています。",
389389
"lcCurveLt2.kusabi": "線が2回曲がっていません。",
390390
"lcCurveNe.firefly": "線の曲がった回数が数字と違っています。",

src/variety/bwloop.js

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
(function(pidlist, classbase) {
2+
if (typeof module === "object" && module.exports) {
3+
module.exports = [pidlist, classbase];
4+
} else {
5+
pzpr.classmgr.makeCustom(pidlist, classbase);
6+
}
7+
})(["bwloop"], {
8+
//---------------------------------------------------------
9+
// マウス入力系
10+
MouseEvent: {
11+
inputModes: {
12+
edit: ["circle-shade", "circle-unshade", "undef", "clear", "info-line"],
13+
play: ["line", "peke", "info-line"]
14+
},
15+
16+
autoedit_func: "qnum",
17+
autoplay_func: "line"
18+
},
19+
20+
//---------------------------------------------------------
21+
// キーボード入力系
22+
KeyEvent: {
23+
enablemake: true
24+
},
25+
26+
//---------------------------------------------------------
27+
// 盤面管理系
28+
Cell: {
29+
numberAsObject: true,
30+
maxnum: 2
31+
},
32+
33+
Board: {
34+
hasborder: 1
35+
},
36+
37+
LineGraph: {
38+
enabled: true
39+
},
40+
41+
//---------------------------------------------------------
42+
// 画像表示系
43+
Graphic: {
44+
irowake: true,
45+
46+
gridcolor_type: "LIGHT",
47+
48+
circlefillcolor_func: "qnum2",
49+
circlestrokecolor_func: "qnum2",
50+
51+
paint: function() {
52+
this.drawBGCells();
53+
this.drawDashedGrid();
54+
55+
this.drawCircles();
56+
this.drawHatenas();
57+
58+
this.drawPekes();
59+
this.drawLines();
60+
61+
this.drawChassis();
62+
63+
this.drawTarget();
64+
}
65+
},
66+
67+
//---------------------------------------------------------
68+
// URLエンコード/デコード処理
69+
Encode: {
70+
decodePzpr: function(type) {
71+
this.decodeCircle();
72+
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
73+
},
74+
encodePzpr: function(type) {
75+
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
76+
this.encodeCircle();
77+
}
78+
},
79+
//---------------------------------------------------------
80+
FileIO: {
81+
decodeData: function() {
82+
this.decodeConfigFlag("f", "loop_full");
83+
this.decodeCellQnum();
84+
this.decodeBorderLine();
85+
},
86+
encodeData: function() {
87+
this.encodeConfigFlag("f", "loop_full");
88+
this.encodeCellQnum();
89+
this.encodeBorderLine();
90+
}
91+
},
92+
93+
AnsCheck: {
94+
checklist: [
95+
"checkLineExist+",
96+
"checkBranchLine",
97+
"checkCrossLine",
98+
99+
"checkEqualCircles",
100+
"checkDiffCircles",
101+
"checkTwoCorners",
102+
103+
"checkNoLinePearl",
104+
"checkDeadendLine+",
105+
"checkNoLineIfVariant",
106+
"checkOneLoop"
107+
],
108+
109+
checkNoLinePearl: function() {
110+
this.checkAllCell(function(cell) {
111+
return cell.isNum() && cell.lcnt === 0;
112+
}, "mashuOnLine");
113+
},
114+
115+
checkEqualCircles: function() {
116+
this.checkLineShape(function(path) {
117+
var cell1 = path.cells[0],
118+
cell2 = path.cells[1];
119+
120+
if (
121+
cell1.qnum !== cell2.qnum ||
122+
!cell1.isValidNum() ||
123+
!cell2.isValidNum()
124+
) {
125+
return false;
126+
}
127+
return path.ccnt === 1;
128+
}, "lcCurveNe0");
129+
},
130+
checkDiffCircles: function() {
131+
this.checkLineShape(function(path) {
132+
var cell1 = path.cells[0],
133+
cell2 = path.cells[1];
134+
135+
if (
136+
cell1.qnum === cell2.qnum ||
137+
!cell1.isValidNum() ||
138+
!cell2.isValidNum()
139+
) {
140+
return false;
141+
}
142+
return path.ccnt === 0;
143+
}, "lcCurveNe1");
144+
},
145+
checkTwoCorners: function() {
146+
this.checkLineShape(function(path) {
147+
return path.ccnt > 1;
148+
}, "lcCurveGt1");
149+
}
150+
}
151+
});

test/script/bwloop.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* bwloop.js */
2+
3+
ui.debug.addDebugData("bwloop", {
4+
url: "5/5/a16i32c60",
5+
failcheck: [
6+
[
7+
"brNoLine",
8+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /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 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /"
9+
],
10+
[
11+
"lnBranch",
12+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /0 0 0 0 /1 0 0 0 /0 1 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 0 /0 1 0 0 0 /0 1 0 0 0 /0 0 0 0 0 /"
13+
],
14+
[
15+
"lnCross",
16+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /0 1 1 0 /0 0 1 1 /0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 1 0 /0 0 0 1 1 /0 0 0 0 1 /0 0 0 0 0 /"
17+
],
18+
[
19+
"lnPlLoop",
20+
"pzprv3/bwloop/5/5/1 . 1 . . /. . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /1 1 1 1 /1 1 1 1 /0 0 1 0 /0 0 0 1 /0 0 1 1 /1 0 0 0 1 /0 0 0 0 0 /0 0 1 1 0 /0 0 1 0 1 /"
21+
],
22+
[
23+
"lcCurveNe0",
24+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /0 0 1 1 /0 0 0 1 /0 0 0 1 /0 0 0 0 /0 0 1 1 /0 0 0 0 1 /0 0 0 1 0 /0 0 0 0 1 /0 0 0 0 1 /"
25+
],
26+
[
27+
"lcCurveNe1",
28+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /1 1 1 1 /0 0 1 0 /0 0 0 0 /0 0 0 1 /1 1 0 0 /1 0 0 0 1 /1 0 1 1 1 /1 0 1 1 1 /1 0 1 0 0 /"
29+
],
30+
[
31+
"lcCurveGt1",
32+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /0 0 1 1 /0 0 0 0 /0 0 0 1 /1 0 0 1 /1 1 1 1 /0 0 0 0 1 /0 0 0 0 1 /0 0 0 1 0 /1 0 0 0 1 /"
33+
],
34+
[
35+
"mashuOnLine",
36+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /1 1 1 1 /0 0 0 1 /0 0 0 0 /1 1 0 1 /0 0 1 1 /1 0 0 0 1 /1 0 0 1 0 /1 0 0 1 0 /0 0 1 0 1 /"
37+
],
38+
[
39+
"lnDeadEnd",
40+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /1 1 1 1 /1 0 1 1 /0 0 1 0 /0 0 0 1 /0 0 1 1 /1 0 0 0 1 /0 1 1 0 0 /0 0 0 1 0 /0 0 1 0 1 /"
41+
],
42+
[
43+
null,
44+
"pzprv3/bwloop/5/5/1 . 1 . . /1 . 2 . 2 /. . . 1 . /. . 2 1 1 /. . 2 . . /1 1 1 1 /0 0 1 1 /0 0 1 0 /1 1 0 1 /0 0 1 1 /1 0 0 0 1 /1 0 1 0 0 /1 0 0 1 0 /0 0 1 0 1 /"
45+
]
46+
],
47+
inputs: []
48+
});

0 commit comments

Comments
 (0)