Skip to content

Commit cf20890

Browse files
committed
Add Sashikabe
1 parent a3cbe92 commit cf20890

4 files changed

Lines changed: 155 additions & 39 deletions

File tree

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: 113 additions & 39 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,
@@ -280,16 +287,41 @@
280287
cols: 8,
281288
rows: 8,
282289

283-
hasborder: 1
290+
hasborder: 1,
291+
addExtraInfo: function() {
292+
this.lgraph = this.addInfoList(this.klass.AreaLGraph);
293+
}
284294
},
285-
"BoardExec@loute,sashigane": {
295+
"BoardExec@loute,sashigane,sashikabe": {
286296
adjustBoardData: function(key, d) {
287297
this.adjustNumberArrow(key, d);
288298
}
289299
},
290300

291-
AreaRoomGraph: {
301+
"AreaShadeGraph@sashikabe": {
292302
enabled: true,
303+
coloring: true
304+
},
305+
"AreaLGraph:AreaUnshadeGraph@sashikabe#1": {
306+
enabled: true
307+
},
308+
"AreaLGraph:AreaRoomGraph@loute,sashigane,sashikazune#1": {
309+
enabled: true
310+
},
311+
312+
"AreaLGraph#3": {
313+
getComponentRefs: function(obj) {
314+
return obj.lcomp;
315+
}, // getSideAreaInfo用
316+
setComponentRefs: function(obj, component) {
317+
obj.lcomp = component;
318+
},
319+
getObjNodeList: function(nodeobj) {
320+
return nodeobj.lcompnodes;
321+
},
322+
resetObjNodeList: function(nodeobj) {
323+
nodeobj.lcompnodes = [];
324+
},
293325

294326
// オーバーライド
295327
resetExtraData: function(cell) {
@@ -306,7 +338,7 @@
306338
var subclist = this.board
307339
.cellinside(d.x1, d.y1, d.x2, d.y2)
308340
.filter(function(cell) {
309-
return cell.room !== component;
341+
return cell.lcomp !== component;
310342
});
311343
var dl = subclist.getRectSize();
312344
if (
@@ -357,7 +389,7 @@
357389
}
358390
},
359391

360-
"AreaRoomGraph@sashikazune": {
392+
"AreaLGraph@sashikazune#2": {
361393
setCellPlaces: function(clist, d, dl) {
362394
var bd = this.board;
363395
var corner = null;
@@ -396,11 +428,16 @@
396428
paint: function() {
397429
this.drawBGCells();
398430
this.drawDashedGrid();
399-
this.drawBorders();
431+
if (this.pid === "sashikabe") {
432+
this.drawShadedCells();
433+
this.drawDotCells();
434+
} else {
435+
this.drawBorders();
436+
}
400437

401438
this.drawCellArrows();
402439
this.drawHatenas_loute();
403-
if (this.pid === "sashigane") {
440+
if (this.pid === "sashigane" || this.pid === "sashikabe") {
404441
this.drawCircledNumbers();
405442
} else if (this.pid === "loute") {
406443
this.drawCircles();
@@ -553,7 +590,7 @@
553590
this.outbstr += cm;
554591
}
555592
},
556-
"Encode@sashigane": {
593+
"Encode@sashigane,sashikabe": {
557594
decodePzpr: function(type) {
558595
this.decodeSashigane();
559596
},
@@ -651,6 +688,10 @@
651688
}
652689
} else if (ca === "-") {
653690
cell.qdir = -2;
691+
} else if (ca === "#") {
692+
cell.qans = 1;
693+
} else if (ca === "_") {
694+
cell.qsub = 1;
654695
} else if (ca !== ".") {
655696
cell.qdir = +ca;
656697
}
@@ -661,12 +702,16 @@
661702
encodeData: function() {
662703
var pid = this.pid;
663704
this.encodeCell(function(cell) {
664-
if (pid === "sashigane" && cell.qdir === 5) {
705+
if ((pid === "sashigane" || pid === "sashikabe") && cell.qdir === 5) {
665706
return "o" + (cell.qnum !== -1 ? cell.qnum : "") + " ";
666707
} else if (cell.qdir === -2) {
667708
return "- ";
668709
} else if (cell.qdir !== 0) {
669710
return cell.qdir + " ";
711+
} else if (cell.qsub) {
712+
return "_ ";
713+
} else if (cell.qans) {
714+
return "# ";
670715
} else {
671716
return ". ";
672717
}
@@ -692,16 +737,29 @@
692737
// 正解判定処理実行部
693738
AnsCheck: {
694739
checklist: [
740+
"check2x2ShadeCell@sashikabe",
695741
"checkArrowCorner1",
696742
"checkArrowCorner2",
697743
"checkCircleCorner",
698-
"checkNumberAndSize+@sashigane",
699-
"checkBorderDeadend",
700-
"checkLblock"
744+
"checkNumberAndSize+@sashigane,sashikabe",
745+
"checkBorderDeadend@!sashikabe",
746+
"checkLblock",
747+
"checkConnectShade@sashikabe",
748+
"doneShadingDecided@sashikabe"
701749
],
702750

751+
checkNumberAndSize: function() {
752+
this.checkAllArea(
753+
this.board.lgraph,
754+
function(w, h, a, n) {
755+
return n <= 0 || n === a;
756+
},
757+
"bkSizeNe"
758+
);
759+
},
760+
703761
checkArrowCorner1: function() {
704-
var rooms = this.board.roommgr.components;
762+
var rooms = this.board.lgraph.components;
705763
allloop: for (var id = 0; id < rooms.length; id++) {
706764
if (rooms[id].shape === 0) {
707765
continue;
@@ -726,7 +784,7 @@
726784
},
727785

728786
checkArrowCorner2: function() {
729-
var rooms = this.board.roommgr.components;
787+
var rooms = this.board.lgraph.components;
730788
allloop: for (var id = 0; id < rooms.length; id++) {
731789
if (rooms[id].shape === 0) {
732790
continue;
@@ -761,7 +819,7 @@
761819
},
762820

763821
checkCircleCorner: function() {
764-
var rooms = this.board.roommgr.components;
822+
var rooms = this.board.lgraph.components;
765823
allloop: for (var id = 0; id < rooms.length; id++) {
766824
if (rooms[id].shape === 0) {
767825
continue;
@@ -785,7 +843,7 @@
785843
},
786844

787845
checkLblock: function() {
788-
var rooms = this.board.roommgr.components;
846+
var rooms = this.board.lgraph.components;
789847
for (var id = 0; id < rooms.length; id++) {
790848
if (rooms[id].shape !== 0) {
791849
continue;
@@ -799,6 +857,22 @@
799857
}
800858
}
801859
},
860+
"AnsCheck@sashikabe": {
861+
checkArrowCorner2: function() {
862+
this.checkAllCell(function(cell) {
863+
var dir = cell.getObjNum();
864+
if (dir < 1 || dir > 4) {
865+
return false;
866+
}
867+
868+
var next = cell
869+
.getaddr()
870+
.movedir(dir, 2)
871+
.getc();
872+
return next.isnull || next.isShade();
873+
}, "arNotPtCnr");
874+
}
875+
},
802876
"AnsCheck@sashikazune": {
803877
checklist: [
804878
"checkNumberDistance",
@@ -817,7 +891,7 @@
817891

818892
checkNumber3Count: function() {
819893
this.checkAllBlock(
820-
this.board.roommgr,
894+
this.board.lgraph,
821895
function(cell) {
822896
return cell.isNum() && cell.place !== 0;
823897
},

test/script/sashikabe.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* sashikabe.js */
2+
3+
ui.debug.addDebugData("sashikabe", {
4+
url: "7/7/3l4yhkhyjn.p",
5+
failcheck: [
6+
[
7+
"ciNotOnCnr",
8+
"pzprv3/sashikabe/7/7/o3 # . o4 . . . /. . # . . . . /# # . . . 2 . /2 . . . . . . /. . . . . . . /. . 4 . . . . /o . . . . . . /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 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 0 0 0 0 /"
9+
],
10+
[
11+
"arBlkEdge",
12+
"pzprv3/sashikabe/7/7/o3 . . o4 . . . /# . . . . . . /. # . . . 2 . /2 # . . . . . /. # . . . . . /_ # 4 . . . . /o _ # . . . . /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 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 0 0 0 0 /"
13+
],
14+
[
15+
"arNotPtCnr",
16+
"pzprv3/sashikabe/7/7/o3 . . o4 . . . /. . . . . . . /. # # # # 2 . /2 # . . # . . /. # . # # . . /. # 4 # . . . /o # # # . . . /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 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 0 0 0 0 /"
17+
],
18+
[
19+
"bkSizeNe",
20+
"pzprv3/sashikabe/7/7/o3 . # o4 . . . /. # # . # # # /# # . # # 2 # /2 # . . # . # /. # # # # . # /. # 4 . . . # /o . # # # # # /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 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 0 0 0 0 /"
21+
],
22+
[
23+
"bkNotLshape",
24+
"pzprv3/sashikabe/7/7/o3 . # o4 . . # /. # # . # # # /# # . # # 2 # /2 # . . # . . /. # # # # # # /. # 4 . . . # /o . # # # # # /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 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 0 0 0 0 /"
25+
],
26+
[
27+
"cs2x2",
28+
"pzprv3/sashikabe/7/7/o3 . # o . # # /. # # . # # # /# # . # # 2 # /2 # . . # . # /. # # # # . # /. # 4 . . . # /o . # # # # # /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 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 0 0 0 0 /"
29+
],
30+
[
31+
"csDivide",
32+
"pzprv3/sashikabe/7/7/o3 . # o4 . . # /. # # . # # # /# # . # # 2 # /2 # . . # . . /. # # # # # # /. # 4 . . . . /o . # # # # . /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 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 0 0 0 0 /"
33+
],
34+
[
35+
null,
36+
"pzprv3/sashikabe/7/7/o3 _ # o4 _ _ # /_ # # _ # # # /# # _ # # 2 # /2 # _ _ # _ # /_ # # # # _ # /_ # 4 _ _ _ # /o _ # # # # # /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 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 0 0 0 0 /"
37+
]
38+
],
39+
inputs: []
40+
});

0 commit comments

Comments
 (0)