Skip to content

Commit bb36ea1

Browse files
authored
Add Bhai Bahan
1 parent 352ba86 commit bb36ea1

11 files changed

Lines changed: 272 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?bhaibahan" target="_parent">Bhai Bahan</a></li>
3637
<li><a href="/p?oasis" target="_parent">Oasis</a></li>
3738
<li><a href="/p?circuitwalk" target="_parent">Circuit Walk</a></li>
3839
<li><a href="/p?cornerch" target="_parent">Corner Chain 隅角チェーン</a></li>
3940
<li><a href="/p?sendai" target="_parent">Sendai-Miyagi 宮城県仙台市</a></li>
4041
<li><a href="/p?keywest" target="_parent">Key West キーウエスト</a></li>
4142
<li><a href="/p?morningwalk" target="_parent">Morning Walk</a></li>
42-
<li><a href="/p?energywalk" target="_parent">Energy Walk</a></li>
4343
</ul>
4444
</main>
4545
</body>

src-ui/img/bhaibahan.png

146 Bytes
Loading

src-ui/js/ui/KeyPopup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ ui.keypopup = {
244244
energywalk: [10, 0],
245245
cornerch: [10, 0],
246246
keywest: [4, 4],
247-
oasis: [10, 0]
247+
oasis: [10, 0],
248+
bhaibahan: [10, 0]
248249
},
249250

250251
//---------------------------------------------------------------------------

src-ui/js/ui/Misc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function toBGimage(pid) {
117117
"batten",
118118
"battleship",
119119
"bdwalk",
120+
"bhaibahan",
120121
"bosnianroad",
121122
"brownies",
122123
"bunnyhop",

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
182182
<li data-pid="kurarin"></li>
183183
<li data-pid="bunnyhop"></li>
184184
<li data-pid="morningwalk"></li>
185+
<li data-pid="bhaibahan"></li>
185186
</ul>
186187
</div>
187188
<div class="lists loops">

src/puzzle/Config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,8 @@
544544
"firewalk",
545545
"forestwalk",
546546
"morningwalk",
547-
"wataridori"
547+
"wataridori",
548+
"bhaibahan"
548549
].indexOf(pid) >= 0;
549550
break;
550551
default:

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
battleship: [0, 0, "Battleship", "Battleship", "statuepark"],
107107
bdblock: [1, 0, "ボーダーブロック", "Border Block"],
108108
bdwalk: [0, 0, "ビルウォーク", "Building Walk", "haisu"],
109+
bhaibahan: [0, 0, "Bhai Bahan", "Bhai Bahan"],
109110
blindrush: [0, 0, "猪突猛進", "Blind Rush"],
110111
bonsan: [1, 0, "ぼんさん", "Bonsan", "bonsan"],
111112
bosanowa: [1, 0, "ボサノワ", "Bosanowa", "", { alias: "bossanova" }],

src/res/failcode.en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@
278278
"bkSizeEq.fillmat": "The number is equal to the size of the tatami.",
279279
"bkSizeEq.morningwalk": "A shaded visit and the following unshaded visit have the same length.",
280280
"bkSizeGt.aquapelago": "A group of shaded cells is larger than the number.",
281+
"bkSizeGt.bhaibahan": "A segment of similar cells is longer than the number.",
281282
"bkSizeGt.dbchoco": "A number is smaller than the size of the shape.",
282283
"bkSizeGt.fillomino": "A number is smaller than the size of the area.",
283284
"bkSizeGt.icewalk": "A section of unshaded cells is longer than the number.",
@@ -290,6 +291,7 @@
290291
"bkSizeGt4": "The size of an area is larger than four.",
291292
"bkSizeGt5": "The size of an area is larger than five.",
292293
"bkSizeLt.aquapelago": "A group of shaded cells is smaller than the number.",
294+
"bkSizeLt.bhaibahan": "A segment of similar cells is shorter than the number.",
293295
"bkSizeLt.dbchoco": "A number is bigger than the size of the shape.",
294296
"bkSizeLt.fillomino": "A number is bigger than the size of the area.",
295297
"bkSizeLt.icewalk": "A section of unshaded cells is shorter than the number.",
@@ -611,6 +613,7 @@
611613
"lnCrossOnNum.pipelink": "Lines are crossed on a number.",
612614
"lnCrossPencil.pencils": "A line crosses a pencil.",
613615
"lnCrossSelf": "A loop crosses itself.",
616+
"lnCurveEq.bhaibahan": "Two adjacent circles don't have one straight line and one turn.",
614617
"lnCurveOnCir.pipelink": "A line turns on a circle.",
615618
"lnCurveOnCir.portal": "A line turns on an unmarked portal.",
616619
"lnCurveOnIce": "A line turns on ice.",

src/variety/bhaibahan.js

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
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+
})(["bhaibahan"], {
8+
MouseEvent: {
9+
inputModes: {
10+
edit: ["number", "undef", "clear", "info-line"],
11+
play: ["line", "peke", "bgcolor", "bgcolor1", "bgcolor2", "info-line"]
12+
},
13+
autoedit_func: "qnum",
14+
mouseinputAutoPlay: function() {
15+
if (this.btn === "left") {
16+
if (this.mousestart || this.mousemove) {
17+
this.inputLine();
18+
} else if (this.mouseend && this.notInputted()) {
19+
if (!this.inputpeke_ifborder()) {
20+
this.inputMB();
21+
}
22+
}
23+
} else if (this.btn === "right") {
24+
if (this.mousestart || this.mousemove) {
25+
this.inputpeke();
26+
} else if (this.mouseend && this.notInputted()) {
27+
if (!this.inputpeke_ifborder()) {
28+
this.inputMB();
29+
}
30+
}
31+
}
32+
}
33+
},
34+
KeyEvent: {
35+
enablemake: true
36+
},
37+
Border: {
38+
enableLineNG: true,
39+
isLineNG: function() {
40+
return !this.inside;
41+
},
42+
posthook: {
43+
line: function(val) {
44+
this.board.roommgr.isStale = true;
45+
}
46+
}
47+
},
48+
Cell: {
49+
l2cnt: 0,
50+
maxnum: function() {
51+
return this.board.cols * this.board.rows;
52+
}
53+
},
54+
Board: {
55+
hasborder: 1
56+
},
57+
Graphic: {
58+
hideHatena: true,
59+
irowake: true,
60+
61+
bgcellcolor_func: "qsub2",
62+
qsubcolor1: "rgb(224, 224, 255)",
63+
qsubcolor2: "rgb(255, 255, 144)",
64+
65+
paint: function() {
66+
this.drawBGCells();
67+
this.drawDashedGrid(false);
68+
69+
this.drawLines();
70+
71+
this.drawPekes();
72+
this.drawCircledNumbers();
73+
74+
this.drawChassis();
75+
this.drawTarget();
76+
}
77+
},
78+
LineGraph: {
79+
enabled: true
80+
},
81+
AreaRoomGraph: {
82+
countprop: "l2cnt",
83+
enabled: true,
84+
relation: {
85+
"cell.ques": "node",
86+
"border.line": "separator"
87+
},
88+
isedgevalidbylinkobj: function(border) {
89+
if (!border.isLine()) {
90+
return false;
91+
}
92+
93+
// TODO this in combination is isClosed isn't great
94+
if (
95+
border.sidecell[0].lcnt !== 2 ||
96+
border.sidecell[1].lcnt !== 2 ||
97+
border.sidecell[0].isLineCurve() !== border.sidecell[1].isLineCurve()
98+
) {
99+
return false;
100+
}
101+
102+
return true;
103+
},
104+
setExtraData: function(component) {
105+
this.common.setExtraData.call(this, component);
106+
component.isClosed = !component.clist.some(function(c) {
107+
return c.lcnt !== 2;
108+
});
109+
}
110+
},
111+
Encode: {
112+
decodePzpr: function() {
113+
this.decodeNumber16();
114+
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
115+
},
116+
encodePzpr: function() {
117+
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
118+
this.encodeNumber16();
119+
}
120+
},
121+
FileIO: {
122+
decodeData: function() {
123+
this.decodeConfigFlag("f", "loop_full");
124+
this.decodeCellQnum();
125+
this.decodeCellQanssub();
126+
this.decodeBorderLine();
127+
},
128+
encodeData: function() {
129+
this.encodeConfigFlag("f", "loop_full");
130+
this.encodeCellQnum();
131+
this.encodeCellQanssub();
132+
this.encodeBorderLine();
133+
}
134+
},
135+
AnsCheck: {
136+
checklist: [
137+
"checkLineExist+",
138+
"checkBranchLine",
139+
"checkCrossLine",
140+
"checkAdjacentCircles",
141+
142+
"checkLessWalk",
143+
"checkOverWalk",
144+
145+
"checkOneLoop",
146+
"checkNoLineOnNum",
147+
"checkNoLineIfVariant",
148+
149+
"checkDeadendLine+"
150+
],
151+
152+
checkAdjacentCircles: function() {
153+
this.checkSideCell(function(cell1, cell2) {
154+
return (
155+
cell1.isNum() &&
156+
cell2.isNum() &&
157+
cell1.lcnt === 2 &&
158+
cell2.lcnt === 2 &&
159+
cell1.isLineCurve() === cell2.isLineCurve()
160+
);
161+
}, "lnCurveEq");
162+
},
163+
164+
checkLessWalk: function() {
165+
this.checkWalkLength(-1, "bkSizeLt");
166+
},
167+
checkOverWalk: function() {
168+
this.checkWalkLength(+1, "bkSizeGt");
169+
},
170+
171+
checkWalkLength: function(flag, code) {
172+
if (this.board.roommgr.isStale) {
173+
this.board.roommgr.isStale = false;
174+
this.board.roommgr.rebuild();
175+
}
176+
for (var i = 0; i < this.board.cell.length; i++) {
177+
var cell = this.board.cell[i];
178+
var qnum = cell.qnum;
179+
if (qnum <= 0 || !cell.room) {
180+
continue;
181+
}
182+
183+
if (flag < 0 && !cell.room.isClosed) {
184+
continue;
185+
}
186+
187+
var d = cell.room.clist.length;
188+
189+
if (flag > 0 ? d > qnum : d < qnum) {
190+
this.failcode.add(code);
191+
if (this.checkOnly) {
192+
return;
193+
}
194+
cell.room.clist.seterr(1);
195+
}
196+
}
197+
},
198+
199+
checkNoLineOnNum: function() {
200+
this.checkAllCell(function(cell) {
201+
return cell.qnum !== -1 && cell.lcnt === 0;
202+
}, "lnIsolate");
203+
}
204+
},
205+
FailCode: {
206+
lnIsolate: "lnIsolate.country"
207+
}
208+
});

src/variety/icewalk.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
}
234234
},
235235
Cell: {
236+
l2cnt: 0,
236237
updateFireQans: function() {},
237238
posthook: {
238239
qnum: function(val) {
@@ -284,9 +285,6 @@
284285
}
285286
}
286287
},
287-
Cross: {
288-
l2cnt: 0
289-
},
290288
"Dot@firewalk": {
291289
getDot: function() {
292290
if (this.piece.group === "cross") {

0 commit comments

Comments
 (0)