Skip to content

Commit f2e0ef2

Browse files
committed
Add Sashikabe
1 parent a3cbe92 commit f2e0ef2

5 files changed

Lines changed: 190 additions & 42 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?sashikabe" target="_parent">Sashikabe</a></li>
3637
<li><a href="/p?blindrush" target="_parent">Blind Rush 猪突猛進</a></li>
3738
<li><a href="/p?cityspace" target="_parent">City Space</a></li>
3839
<li><a href="/p?numcity" target="_parent">Number City ナンバーシティ一</a></li>
3940
<li><a href="/p?distopia" target="_parent">Distopia</a></li>
4041
<li><a href="/p?uturns" target="_parent">U-Turns</a></li>
4142
<li><a href="/p?isowatari" target="_parent">Isowatari イソワタリ</a></li>
42-
<li><a href="/p?narrow" target="_parent">Narrowfence</a></li>
4343
</ul>
4444
</main>
4545
</body>

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
6868
<li data-pid="island"></li>
6969
<li data-pid="isowatari"></li>
7070
<li data-pid="cityspace"></li>
71+
<li data-pid="sashikabe"></li>
7172
</ul>
7273
</div>
7374
<div class="lists blocks">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@
378378
roma: [0, 0, "ろーま", "Roma", "", { alias: "rome" }],
379379
roundtrip: [0, 0, "Round Trip", "Round Trip"],
380380
sananko: [0, 0, "サンアンコー", "San-Anko", "kakuru"],
381+
sashikabe: [0, 0, "Sashikabe", "Sashikabe", "loute"],
381382
sashigane: [0, 0, "さしがね", "Sashigane", "loute"],
382383
sashikazune: [0, 0, "さしカズね", "Sashikazune", "loute"],
383384
satogaeri: [

src/variety/loute.js

Lines changed: 129 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,37 @@
77
} else {
88
pzpr.classmgr.makeCustom(pidlist, classbase);
99
}
10-
})(["loute", "sashigane", "sashikazune"], {
10+
})(["loute", "sashigane", "sashikazune", "sashikabe"], {
1111
//---------------------------------------------------------
1212
// マウス入力系
1313
"MouseEvent@loute": {
14+
autoplay_func: "border",
1415
inputModes: {
1516
edit: ["arrow", "circle-unshade", "undef", "clear"],
1617
play: ["border", "subline"]
1718
}
1819
},
1920
"MouseEvent@sashigane": {
21+
autoplay_func: "border",
2022
inputModes: {
2123
edit: ["arrow", "number", "undef", "clear"],
2224
play: ["border", "subline"]
23-
},
25+
}
26+
},
27+
"MouseEvent@sashikabe": {
28+
use: true,
29+
autoplay_func: "cell",
30+
inputModes: {
31+
edit: ["arrow", "number", "undef", "clear", "info-blk"],
32+
play: ["shade", "unshade", "info-blk"]
33+
}
34+
},
35+
"MouseEvent@loute,sashigane,sashikabe#1": {
2436
mouseinput_number: function() {
2537
if (this.mousestart) {
2638
this.inputqnum_loute();
2739
}
28-
}
29-
},
30-
"MouseEvent@loute,sashigane#1": {
40+
},
3141
mouseinput: function() {
3242
// オーバーライド
3343
if (this.inputMode === "undef" || this.inputMode === "circle-unshade") {
@@ -38,21 +48,11 @@
3848
this.common.mouseinput.call(this);
3949
}
4050
},
41-
mouseinput_auto: function() {
42-
if (this.puzzle.playmode) {
43-
if (this.mousestart || this.mousemove) {
44-
if (this.btn === "left" && this.isBorderMode()) {
45-
this.inputborder();
46-
} else {
47-
this.inputQsubLine();
48-
}
49-
}
50-
} else if (this.puzzle.editmode) {
51-
if (this.mousestart || this.mousemove) {
52-
this.inputarrow_cell();
53-
} else if (this.mouseend && this.notInputted()) {
54-
this.inputqnum_loute();
55-
}
51+
mouseinputAutoEdit: function() {
52+
if (this.mousestart || this.mousemove) {
53+
this.inputarrow_cell();
54+
} else if (this.mouseend && this.notInputted()) {
55+
this.inputqnum_loute();
5656
}
5757
},
5858

@@ -157,7 +157,7 @@
157157
KeyEvent: {
158158
enablemake: true
159159
},
160-
"KeyEvent@loute,sashigane": {
160+
"KeyEvent@loute,sashigane,sashikabe": {
161161
moveTarget: function(ca) {
162162
if (ca.match(/shift/)) {
163163
return false;
@@ -172,7 +172,7 @@
172172

173173
if (this.pid === "loute") {
174174
this.key_arrow_loute(ca);
175-
} else if (this.pid === "sashigane") {
175+
} else {
176176
this.key_inputqnum_sashigane(ca);
177177
}
178178
},
@@ -251,6 +251,13 @@
251251
//---------------------------------------------------------
252252
// 盤面管理系
253253
Cell: {
254+
allowShade: function() {
255+
return !this.qdir;
256+
},
257+
allowUnshade: function() {
258+
return !this.qdir;
259+
},
260+
254261
maxnum: function() {
255262
var bd = this.board,
256263
bx = this.bx,
@@ -269,6 +276,16 @@
269276
return this.qdir === 5;
270277
}
271278
},
279+
"Cell@sashikabe": {
280+
posthook: {
281+
qdir: function(num) {
282+
if (num) {
283+
this.setQans(0);
284+
this.setQsub(0);
285+
}
286+
}
287+
}
288+
},
272289
"Cell@sashikazune": {
273290
minnum: 1,
274291
maxnum: function() {
@@ -280,16 +297,41 @@
280297
cols: 8,
281298
rows: 8,
282299

283-
hasborder: 1
300+
hasborder: 1,
301+
addExtraInfo: function() {
302+
this.lgraph = this.addInfoList(this.klass.AreaLGraph);
303+
}
284304
},
285-
"BoardExec@loute,sashigane": {
305+
"BoardExec@loute,sashigane,sashikabe": {
286306
adjustBoardData: function(key, d) {
287307
this.adjustNumberArrow(key, d);
288308
}
289309
},
290310

291-
AreaRoomGraph: {
311+
"AreaShadeGraph@sashikabe": {
292312
enabled: true,
313+
coloring: true
314+
},
315+
"AreaLGraph:AreaUnshadeGraph@sashikabe#1": {
316+
enabled: true
317+
},
318+
"AreaLGraph:AreaRoomGraph@loute,sashigane,sashikazune#1": {
319+
enabled: true
320+
},
321+
322+
"AreaLGraph#3": {
323+
getComponentRefs: function(obj) {
324+
return obj.lcomp;
325+
}, // getSideAreaInfo用
326+
setComponentRefs: function(obj, component) {
327+
obj.lcomp = component;
328+
},
329+
getObjNodeList: function(nodeobj) {
330+
return nodeobj.lcompnodes;
331+
},
332+
resetObjNodeList: function(nodeobj) {
333+
nodeobj.lcompnodes = [];
334+
},
293335

294336
// オーバーライド
295337
resetExtraData: function(cell) {
@@ -306,7 +348,7 @@
306348
var subclist = this.board
307349
.cellinside(d.x1, d.y1, d.x2, d.y2)
308350
.filter(function(cell) {
309-
return cell.room !== component;
351+
return cell.lcomp !== component;
310352
});
311353
var dl = subclist.getRectSize();
312354
if (
@@ -357,7 +399,7 @@
357399
}
358400
},
359401

360-
"AreaRoomGraph@sashikazune": {
402+
"AreaLGraph@sashikazune#2": {
361403
setCellPlaces: function(clist, d, dl) {
362404
var bd = this.board;
363405
var corner = null;
@@ -396,11 +438,16 @@
396438
paint: function() {
397439
this.drawBGCells();
398440
this.drawDashedGrid();
399-
this.drawBorders();
441+
if (this.pid === "sashikabe") {
442+
this.drawShadedCells();
443+
this.drawDotCells();
444+
} else {
445+
this.drawBorders();
446+
}
400447

401448
this.drawCellArrows();
402449
this.drawHatenas_loute();
403-
if (this.pid === "sashigane") {
450+
if (this.pid === "sashigane" || this.pid === "sashikabe") {
404451
this.drawCircledNumbers();
405452
} else if (this.pid === "loute") {
406453
this.drawCircles();
@@ -553,7 +600,7 @@
553600
this.outbstr += cm;
554601
}
555602
},
556-
"Encode@sashigane": {
603+
"Encode@sashigane,sashikabe": {
557604
decodePzpr: function(type) {
558605
this.decodeSashigane();
559606
},
@@ -651,28 +698,40 @@
651698
}
652699
} else if (ca === "-") {
653700
cell.qdir = -2;
701+
} else if (ca === "#") {
702+
cell.qans = 1;
703+
} else if (ca === "_") {
704+
cell.qsub = 1;
654705
} else if (ca !== ".") {
655706
cell.qdir = +ca;
656707
}
657708
});
658709

659-
this.decodeBorderAns();
710+
if (this.pid !== "sashikabe") {
711+
this.decodeBorderAns();
712+
}
660713
},
661714
encodeData: function() {
662715
var pid = this.pid;
663716
this.encodeCell(function(cell) {
664-
if (pid === "sashigane" && cell.qdir === 5) {
717+
if ((pid === "sashigane" || pid === "sashikabe") && cell.qdir === 5) {
665718
return "o" + (cell.qnum !== -1 ? cell.qnum : "") + " ";
666719
} else if (cell.qdir === -2) {
667720
return "- ";
668721
} else if (cell.qdir !== 0) {
669722
return cell.qdir + " ";
723+
} else if (cell.qsub) {
724+
return "_ ";
725+
} else if (cell.qans) {
726+
return "# ";
670727
} else {
671728
return ". ";
672729
}
673730
});
674731

675-
this.encodeBorderAns();
732+
if (pid !== "sashikabe") {
733+
this.encodeBorderAns();
734+
}
676735
}
677736
},
678737
"FileIO@sashikazune": {
@@ -692,16 +751,29 @@
692751
// 正解判定処理実行部
693752
AnsCheck: {
694753
checklist: [
754+
"check2x2ShadeCell@sashikabe",
695755
"checkArrowCorner1",
696756
"checkArrowCorner2",
697757
"checkCircleCorner",
698-
"checkNumberAndSize+@sashigane",
699-
"checkBorderDeadend",
700-
"checkLblock"
758+
"checkNumberAndSize+@sashigane,sashikabe",
759+
"checkBorderDeadend@!sashikabe",
760+
"checkLblock",
761+
"checkConnectShade@sashikabe",
762+
"doneShadingDecided@sashikabe"
701763
],
702764

765+
checkNumberAndSize: function() {
766+
this.checkAllArea(
767+
this.board.lgraph,
768+
function(w, h, a, n) {
769+
return n <= 0 || n === a;
770+
},
771+
"bkSizeNe"
772+
);
773+
},
774+
703775
checkArrowCorner1: function() {
704-
var rooms = this.board.roommgr.components;
776+
var rooms = this.board.lgraph.components;
705777
allloop: for (var id = 0; id < rooms.length; id++) {
706778
if (rooms[id].shape === 0) {
707779
continue;
@@ -726,7 +798,7 @@
726798
},
727799

728800
checkArrowCorner2: function() {
729-
var rooms = this.board.roommgr.components;
801+
var rooms = this.board.lgraph.components;
730802
allloop: for (var id = 0; id < rooms.length; id++) {
731803
if (rooms[id].shape === 0) {
732804
continue;
@@ -761,7 +833,7 @@
761833
},
762834

763835
checkCircleCorner: function() {
764-
var rooms = this.board.roommgr.components;
836+
var rooms = this.board.lgraph.components;
765837
allloop: for (var id = 0; id < rooms.length; id++) {
766838
if (rooms[id].shape === 0) {
767839
continue;
@@ -785,7 +857,7 @@
785857
},
786858

787859
checkLblock: function() {
788-
var rooms = this.board.roommgr.components;
860+
var rooms = this.board.lgraph.components;
789861
for (var id = 0; id < rooms.length; id++) {
790862
if (rooms[id].shape !== 0) {
791863
continue;
@@ -799,6 +871,22 @@
799871
}
800872
}
801873
},
874+
"AnsCheck@sashikabe": {
875+
checkArrowCorner2: function() {
876+
this.checkAllCell(function(cell) {
877+
var dir = cell.getObjNum();
878+
if (dir < 1 || dir > 4) {
879+
return false;
880+
}
881+
882+
var next = cell
883+
.getaddr()
884+
.movedir(dir, 2)
885+
.getc();
886+
return next.isnull || next.isShade();
887+
}, "arNotPtCnr");
888+
}
889+
},
802890
"AnsCheck@sashikazune": {
803891
checklist: [
804892
"checkNumberDistance",
@@ -817,7 +905,7 @@
817905

818906
checkNumber3Count: function() {
819907
this.checkAllBlock(
820-
this.board.roommgr,
908+
this.board.lgraph,
821909
function(cell) {
822910
return cell.isNum() && cell.place !== 0;
823911
},

0 commit comments

Comments
 (0)