Skip to content

Commit

Permalink
Add Full Loop variant to other genres
Browse files Browse the repository at this point in the history
  • Loading branch information
x-sheep authored Jan 16, 2025
1 parent 6a09471 commit 90b5474
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src-ui/js/ui/MenuConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
case "lineofsight":
idname = "slither_full";
break;
case "mashu":
case "geradeweg":
case "disloop":
case "midloop":
case "ovotovata":
case "balance":
case "turnaround":
idname = "loop_full";
break;
}

if (typeof idname === "string") {
Expand Down
6 changes: 6 additions & 0 deletions src-ui/p.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ <h2 id="title2">読み込み中です...</h2>
<span>__slither_full__</span>
</label>
</div>
<div class="config" data-config="loop_full">
<label>
<input type="checkbox">
<span>__loop_full__</span>
</label>
</div>
<div class="config" data-config="variant">
<label>
<input type="checkbox">
Expand Down
1 change: 1 addition & 0 deletions src-ui/res/p.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
"magnets_anti": "Anti-Magnets (adjacent poles of different magnets must be equal)",
"heyapin_overlap": "Pins must overlap 2 or more regions",
"slither_full": "All points must be visited",
"loop_full": "All cells must be visited",
"variant": "This puzzle uses variant rules",
"time": "Time:",
"timer.menu": "Show timer",
Expand Down
16 changes: 16 additions & 0 deletions src/puzzle/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
variant: true,
volatile: true
}); /* All vertices must be visited */
this.add("loop_full", false, {
variant: true,
volatile: true
}); /* All cells must be visited */
/* generic variant */
this.add("variant", false, { variant: true, volatile: true });
this.add("variantid", "", { volatile: true });
Expand Down Expand Up @@ -481,6 +485,18 @@
"lineofsight"
].indexOf(pid) >= 0;
break;
case "loop_full":
exec =
[
"mashu",
"geradeweg",
"disloop",
"midloop",
"ovotovata",
"balance",
"turnaround"
].indexOf(pid) >= 0;
break;
default:
exec = !!this.list[name];
}
Expand Down
5 changes: 4 additions & 1 deletion src/variety-common/Answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,10 @@ pzpr.classmgr.makeCommon({
this.checkLineCount(0, this.board.borderAsLine ? "cxNoLine" : "ceNoLine");
},
checkNoLineIfVariant: function() {
if (this.puzzle.getConfig("slither_full")) {
if (
this.puzzle.getConfig("slither_full") ||
this.puzzle.getConfig("loop_full")
) {
this.checkNoLine();
}
},
Expand Down
5 changes: 5 additions & 0 deletions src/variety/balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@
}
}
this.outbstr = bstr.substr(i);
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function(type) {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
var count = 0,
cm = "",
bd = this.board;
Expand Down Expand Up @@ -312,6 +314,7 @@
},
FileIO: {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeCell(function(cell, ca) {
if (ca === ".") {
return;
Expand All @@ -323,6 +326,7 @@
this.decodeBorderLine();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.encodeCell(function(cell) {
if (cell.qnum !== -1) {
return cell.ques + "," + cell.qnum + " ";
Expand All @@ -344,6 +348,7 @@
"checkBlackEqual",
"checkDeadendLine+",
"checkNoLineCircle",
"checkNoLineIfVariant",
"checkOneLoop"
],

Expand Down
13 changes: 13 additions & 0 deletions src/variety/country.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,9 @@
if (this.pid === "country") {
this.puzzle.setConfig("country_empty", this.checkpflag("e"));
}
if (this.pid === "ovotovata") {
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
}
if (this.pid !== "simpleloop") {
this.decodeBorder();
}
Expand Down Expand Up @@ -791,6 +794,9 @@
if (this.pid === "country") {
this.outpflag = this.puzzle.getConfig("country_empty") ? "e" : null;
}
if (this.pid === "ovotovata") {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
}
if (this.pid !== "simpleloop") {
this.encodeBorder();
}
Expand Down Expand Up @@ -858,6 +864,9 @@
if (this.pid === "country" && this.filever >= 1) {
this.decodeFlags();
}
if (this.pid === "ovotovata") {
this.decodeConfigFlag("f", "loop_full");
}
if (this.pid !== "simpleloop") {
if (this.filever >= 2) {
this.decodeBorderQues();
Expand Down Expand Up @@ -887,6 +896,9 @@
if (this.pid === "country") {
this.encodeFlags(["country_empty"]);
}
if (this.pid === "ovotovata") {
this.encodeConfigFlag("f", "loop_full");
}
if (this.pid !== "simpleloop") {
this.filever = 2;
this.encodeBorderQues();
Expand Down Expand Up @@ -1111,6 +1123,7 @@
"checkHatenaExit",

"checkDeadendLine+",
"checkNoLineIfVariant",
"checkOneLoop"
]
},
Expand Down
5 changes: 5 additions & 0 deletions src/variety/geradeweg.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,21 @@
Encode: {
decodePzpr: function(type) {
this.decodeNumber16();
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function(type) {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
this.encodeNumber16();
}
},
FileIO: {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeCellQnum();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.encodeCellQnum();
this.encodeBorderLine();
}
Expand All @@ -128,6 +132,7 @@
"checkNoLineNumber",

"checkDeadendLine+",
"checkNoLineIfVariant",
"checkOneLoop"
],

Expand Down
5 changes: 5 additions & 0 deletions src/variety/mashu.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@
decodePzpr: function(type) {
this.decodeCircle();
this.board.revCircle();
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function(type) {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
this.board.revCircle();
this.encodeCircle();
this.board.revCircle();
Expand All @@ -150,11 +152,13 @@
//---------------------------------------------------------
FileIO: {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeCellQnum();
this.decodeBorderLine();
this.board.revCircle();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.board.revCircle();
this.encodeCellQnum();
this.encodeBorderLine();
Expand Down Expand Up @@ -201,6 +205,7 @@
"checkWhitePearl2",
"checkNoLinePearl",
"checkDeadendLine+",
"checkNoLineIfVariant",
"checkOneLoop"
],

Expand Down
5 changes: 5 additions & 0 deletions src/variety/midloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,22 @@
Encode: {
decodePzpr: function(type) {
this.decodeDot();
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function(type) {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
this.encodeDot();
}
},
//---------------------------------------------------------
FileIO: {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeDotFile();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.encodeDotFile();
this.encodeBorderLine();
}
Expand All @@ -181,6 +185,7 @@
"checkDotOnLine",

"checkDeadendLine+",
"checkNoLineIfVariant",
"checkOneLoop"
],

Expand Down
5 changes: 5 additions & 0 deletions src/variety/tapaloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,10 @@
"Encode@disloop": {
decodePzpr: function(type) {
this.decodeArrowNumber_disloop();
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function(type) {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
this.encodeArrowNumber_disloop();
},
decodeArrowNumber_disloop: function() {
Expand Down Expand Up @@ -588,11 +590,13 @@
},
"FileIO@disloop": {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeQnums();
this.decodeDirs();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.encodeQnums();
this.encodeDirs();
this.encodeBorderLine();
Expand Down Expand Up @@ -620,6 +624,7 @@
"checkArrowLineExist@disloop",
"checkNumberHasArrow@disloop",
"checkDeadendLine+",
"checkNoLineIfVariant@disloop",
"checkOneLoop"
],

Expand Down
5 changes: 5 additions & 0 deletions src/variety/turnaround.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,21 @@
Encode: {
decodePzpr: function(type) {
this.decodeNumber16();
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function(type) {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
this.encodeNumber16();
}
},
FileIO: {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeCellQnum();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.encodeCellQnum();
this.encodeBorderLine();
}
Expand All @@ -136,6 +140,7 @@
"checkNoLineNumber",

"checkDeadendLine+",
"checkNoLineIfVariant",
"checkOneLoop"
],

Expand Down

0 comments on commit 90b5474

Please sign in to comment.