Skip to content

Commit 569575e

Browse files
authored
Add Circuit Walk
1 parent 7db7e20 commit 569575e

File tree

11 files changed

+130
-9
lines changed

11 files changed

+130
-9
lines changed

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?circuitwalk" target="_parent">Circuit Walk</a></li>
3637
<li><a href="/p?cornerch" target="_parent">Corner Chain 隅角チェーン</a></li>
3738
<li><a href="/p?sendai" target="_parent">Sendai-Miyagi 宮城県仙台市</a></li>
3839
<li><a href="/p?keywest" target="_parent">Key West キーウエスト</a></li>
3940
<li><a href="/p?morningwalk" target="_parent">Morning Walk</a></li>
4041
<li><a href="/p?energywalk" target="_parent">Energy Walk</a></li>
4142
<li><a href="/p?sansaroad" target="_parent">Sansa Road サンサロード</a></li>
42-
<li><a href="/p?diamond" target="_parent">Diamond Chain</a></li>
4343
</ul>
4444
</main>
4545
</body>

src-ui/img/circuitwalk.png

118 Bytes
Loading

src-ui/js/ui/KeyPopup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ ui.keypopup = {
239239
cityspace: [10, 0],
240240
diamond: [4, 0],
241241
sendai: [10, 0],
242+
circuitwalk: [10, 0],
242243
morningwalk: [10, 0],
243244
energywalk: [10, 0],
244245
cornerch: [10, 0],
@@ -510,6 +511,7 @@ ui.keypopup = {
510511
pid === "forestwalk" ||
511512
pid === "morningwalk" ||
512513
pid === "energywalk" ||
514+
pid === "circuitwalk" ||
513515
pid === "dbchoco" ||
514516
pid === "balloon"
515517
) {
@@ -528,6 +530,8 @@ ui.keypopup = {
528530
? "rgb(212,180,212)"
529531
: pid === "energywalk"
530532
? "rgb(255,255,163)"
533+
: pid === "circuitwalk"
534+
? "rgb(118,165,175)"
531535
: "rgb(192,224,255)"
532536
}
533537
]);

src-ui/js/ui/Misc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ function toBGimage(pid) {
124124
"cbanana",
125125
"chainedb",
126126
"circlesquare",
127+
"circuitwalk",
127128
"cityspace",
128129
"cocktail",
129130
"coffeemilk",

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
210210
<li data-pid="icelom"></li>
211211
<li data-pid="icelom2"></li>
212212
<li data-pid="icewalk"></li>
213+
<li data-pid="circuitwalk"></li>
213214
</ul>
214215
</div>
215216
<div class="lists lines">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
cave: [1, 0, "バッグ", "Cave", "kurodoko", { alias: "bag" }],
117117
cbanana: [0, 0, "チョコバナナ", "Choco Banana"],
118118
circlesquare: [0, 0, "Circles and Squares", "Circles and Squares"],
119+
circuitwalk: [0, 0, "Circuit Walk", "Circuit Walk", "icewalk"],
119120
context: [0, 0, "Context", "Context"],
120121
crossstitch: [0, 0, "Crossstitch", "Crossstitch"],
121122
cts: [0, 0, "Cross the Streams", "Cross the Streams", "nonogram"],

src/res/failcode.en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,15 @@
602602
"lnBranch.forestwalk": "There is a branch line outside of a forest cell.",
603603
"lnBranch": "There is a branch line.",
604604
"lnConsecutive.kaidan": "Two adjacent rectangles don't have a size difference of 1.",
605-
"lnCross.crossstitch": "A loop crosses itself.",
606605
"lnCross": "There is a crossing line.",
607606
"lnCrossExCir.pipelink": "There is a crossing line out of circles.",
608607
"lnCrossExIce": "A line is crossed outside of ice.",
608+
"lnCrossExIce.circuitwalk": "A line is crossed outside of a shaded cell.",
609609
"lnCrossExIce.energywalk": "A line is crossed outside of an energy cell.",
610610
"lnCrossExMk": "There is a crossing outside given crosses.",
611611
"lnCrossOnNum.pipelink": "Lines are crossed on a number.",
612612
"lnCrossPencil.pencils": "A line crosses a pencil.",
613+
"lnCrossSelf": "A loop crosses itself.",
613614
"lnCurveOnCir.pipelink": "A line turns on a circle.",
614615
"lnCurveOnCir.portal": "A line turns on an unmarked portal.",
615616
"lnCurveOnIce": "A line turns on ice.",
@@ -637,6 +638,7 @@
637638
"lnLenLt.reflect": "The lines passing a triangle are too short.",
638639
"lnMultipleTips.pencils": "A line connects to more than one pencil tip.",
639640
"lnNoBorder.ladders": "A ladder doesn't touch two region borders.",
641+
"lnNoBranch.circuitwalk": "A visited shaded cell doesn't contain a cross.",
640642
"lnNoBranch.energywalk": "A visited energy cell doesn't branch off in all directions.",
641643
"lnNoBranch.forestwalk": "A visited forest cell doesn't contain a T-junction.",
642644
"lnNoBranch.tjunction": "A cell doesn't contain a T-junction.",
@@ -664,6 +666,7 @@
664666
"lnOverlap.tontti": "A line overlaps a number.",
665667
"lnPassOver.kouchoku": "A segment passes over a clue.",
666668
"lnPlLine": "There are multiple lines.",
669+
"lnPlLoop.circuitwalk": "The various loops don't form a single network.",
667670
"lnPlLoop.crossstitch": "There aren't exactly two loops.",
668671
"lnPlLoop.diamond": "Not all shaded cells and diamonds are connected.",
669672
"lnPlLoop.forestwalk": "There are multiple networks.",

src/res/failcode.ja.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,13 @@
411411
"lcTripleNum": "3つ以上の数字がつながっています。",
412412
"lnAdjacent.tontti": "繋がっている線の形が同じです。",
413413
"lnBranch": "分岐している線があります。",
414-
"lnCross.crossstitch": "線が自己交差しています。",
415414
"lnCross": "線が交差しています。",
416415
"lnCrossExCir.pipelink": "○の部分以外で線が交差しています。",
417416
"lnCrossExIce": "氷の部分以外で線が交差しています。",
418417
"lnCrossExMk": "十字以外の場所で線が交差しています。",
419418
"lnCrossOnNum.pipelink": "○の部分で線が交差しています。",
420419
"lnCrossPencil.pencils": "線が鉛筆の軸と交差しています。",
420+
"lnCrossSelf": "線が自己交差しています。",
421421
"lnCurveOnCir.pipelink": "○の部分で線が曲がっています。",
422422
"lnCurveOnIce": "氷の部分で線が曲がっています。",
423423
"lnDeadEnd": "途中で途切れている線があります。",

src/variety/crossstitch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,5 +888,8 @@
888888
return cell.qans === 33;
889889
}).length;
890890
}
891+
},
892+
FailCode: {
893+
lnCross: "lnCrossSelf"
891894
}
892895
});

src/variety/icewalk.js

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"firewalk",
1313
"forestwalk",
1414
"morningwalk",
15-
"energywalk"
15+
"energywalk",
16+
"circuitwalk"
1617
],
1718
{
1819
MouseEvent: {
@@ -78,7 +79,7 @@
7879
}
7980
}
8081
},
81-
"MouseEvent@morningwalk,energywalk": {
82+
"MouseEvent@morningwalk,energywalk,circuitwalk": {
8283
inputModes: {
8384
edit: ["shade", "number", "clear", "info-line"],
8485
play: ["line", "peke", "info-line"]
@@ -222,6 +223,9 @@
222223
line: function(val) {
223224
this.board.scanResult = null;
224225
this.board.roommgr.isStale = true;
226+
if (this.board.linesupergraph) {
227+
this.board.linesupergraph.isStale = true;
228+
}
225229
for (var sc = 0; sc <= 1; sc++) {
226230
var cell = this.sidecell[sc];
227231
cell.updateFireQans();
@@ -239,6 +243,9 @@
239243
},
240244
ques: function(val) {
241245
this.board.roommgr.isStale = true;
246+
if (this.board.linesupergraph) {
247+
this.board.linesupergraph.isStale = true;
248+
}
242249
if (val === 6) {
243250
this.setQnum(-1);
244251
}
@@ -338,6 +345,11 @@
338345
"Board@firewalk": {
339346
hasdots: 1
340347
},
348+
"Board@circuitwalk": {
349+
addExtraInfo: function() {
350+
this.linesupergraph = this.addInfoList(this.klass.LineSuperGraph);
351+
}
352+
},
341353
"BoardExec@firewalk": {
342354
adjustBoardData: function(key, d) {
343355
if (key & this.TURNFLIP) {
@@ -391,6 +403,9 @@
391403
"Graphic@energywalk": {
392404
icecolor: "rgb(255, 255, 163)"
393405
},
406+
"Graphic@circuitwalk": {
407+
icecolor: "rgb(118, 165, 175)"
408+
},
394409
"Graphic@firewalk": {
395410
icecolor: "rgb(255, 192, 192)",
396411

@@ -544,9 +559,26 @@
544559
LineGraph: {
545560
enabled: true
546561
},
547-
"LineGraph@icewalk": {
562+
"LineGraph@icewalk,circuitwalk": {
548563
isLineCross: true
549564
},
565+
"LineSuperGraph:LineGraph@circuitwalk": {
566+
enabled: true,
567+
isLineCross: false,
568+
countprop: "l3cnt",
569+
getComponentRefs: function(obj) {
570+
return obj.lgrph;
571+
},
572+
setComponentRefs: function(obj, component) {
573+
obj.lgrph = component;
574+
},
575+
getObjNodeList: function(nodeobj) {
576+
return nodeobj.lgrphnodes;
577+
},
578+
resetObjNodeList: function(nodeobj) {
579+
nodeobj.lgrphnodes = [];
580+
}
581+
},
550582
"LineGraph@firewalk": {
551583
relation: { "border.line": "link", "cell.qans": "arcs" },
552584
isLineCross: true,
@@ -720,6 +752,8 @@
720752
"checkForestCell@forestwalk",
721753
"checkEnergyCell@energywalk",
722754
"checkEnergyLoop@energywalk",
755+
"checkCircuitCell@circuitwalk",
756+
"checkSelfIntersect@circuitwalk",
723757

724758
"checkOneLoop",
725759
"checkDoubleTurnOutside@firewalk",
@@ -741,8 +775,6 @@
741775

742776
checkWalkLength: function(flag, code) {
743777
if (this.board.roommgr.isStale) {
744-
// TODO The room manager will break in certain conditions.
745-
// It is rebuilt here as a workaround.
746778
this.board.roommgr.isStale = false;
747779
this.board.roommgr.rebuild();
748780
}
@@ -781,7 +813,7 @@
781813
}, "lnIsolate");
782814
}
783815
},
784-
"AnsCheck@icewalk,energywalk#1": {
816+
"AnsCheck@icewalk,energywalk,circuitwalk#1": {
785817
checkCrossLine: function() {
786818
this.checkAllCell(function(cell) {
787819
return cell.lcnt === 4 && !cell.ice();
@@ -880,6 +912,34 @@
880912
}
881913
}
882914
},
915+
"AnsCheck@circuitwalk": {
916+
checkCircuitCell: function() {
917+
this.checkAllCell(function(cell) {
918+
return cell.lcnt > 1 && cell.ice() && cell.lcnt < 4;
919+
}, "lnNoBranch");
920+
},
921+
checkSelfIntersect: function() {
922+
this.checkAllCell(function(cell) {
923+
return (
924+
cell.lcnt === 4 &&
925+
cell.adjborder.top.path === cell.adjborder.right.path
926+
);
927+
}, "lnCrossSelf");
928+
},
929+
checkOneLoop: function() {
930+
var bd = this.board;
931+
if (bd.linesupergraph.isStale) {
932+
bd.linesupergraph.isStale = false;
933+
bd.linesupergraph.rebuild();
934+
}
935+
var paths = bd.linesupergraph.components;
936+
if (paths.length > 1) {
937+
this.failcode.add("lnPlLoop");
938+
bd.border.setnoerr();
939+
paths[0].setedgeerr(1);
940+
}
941+
}
942+
},
883943
"FailCode@energywalk": {
884944
lnPlLoop: "lnPlLoop.forestwalk"
885945
},

0 commit comments

Comments
 (0)