Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pzpr/variety.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
shugaku: [1, 0, "修学旅行の夜", "School Trip"],
shwolf: [0, 0, "ヤギとオオカミ", "Goats and Wolves", "kramma"],
simplegako: [0, 0, "シンプルガコ", "Simple Gako"],
simpleloop: [0, 0, "シンプルループ", "Simple Loop", "country"],
simpleloop: [0, 0, "シンプルループ", "Simple Loop"],
slalom: [1, 1, "スラローム", "Slalom", "", { alias: "suraromu" }],
slashpack: [0, 0, "Slash Pack", "Slash Pack"],
slither: [
Expand Down
109 changes: 21 additions & 88 deletions src/variety/country.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"onsen",
"doubleback",
"maxi",
"simpleloop",
"detour",
"dotchi",
"ovotovata",
Expand Down Expand Up @@ -106,12 +105,6 @@
clist.draw();
}
},
"MouseEvent@simpleloop": {
inputModes: {
edit: ["clear", "info-line", "empty"],
play: ["line", "peke", "clear", "info-line"]
}
},
"MouseEvent@dotchi,dotchi2": {
inputModes: {
edit: ["border", "circle-shade", "circle-unshade", "clear", "info-line"],
Expand Down Expand Up @@ -201,11 +194,7 @@
this.inputpeke();
}
}
} else if (
this.mouseend &&
this.notInputted() &&
this.pid !== "simpleloop"
) {
} else if (this.mouseend && this.notInputted()) {
if (
this.inputpeke_ifborder() ||
this.pid === "maxi" ||
Expand All @@ -220,10 +209,6 @@
}
}
} else if (this.puzzle.editmode) {
if (this.pid === "simpleloop") {
this.inputempty();
return;
}
if (this.mousestart || this.mousemove) {
this.inputborder();
} else if (this.mouseend && this.notInputted()) {
Expand Down Expand Up @@ -362,7 +347,7 @@
return this.qnum === 2;
}
},
"Cell@doubleback,simpleloop,rassi,remlen": {
"Cell@doubleback,rassi,remlen": {
noLP: function(dir) {
return this.isEmpty();
}
Expand All @@ -372,7 +357,7 @@
return Math.max(this.board.cols, this.board.rows) - 1;
}
},
"Border@doubleback,simpleloop,dotchi,remlen": {
"Border@doubleback,dotchi,remlen": {
enableLineNG: true
},
"Border@moonsun,dotchi,dotchi2#1": {
Expand Down Expand Up @@ -555,7 +540,7 @@
gridcolor_type: "SLIGHT",

paint: function() {
if (this.pid !== "remlen" && this.pid !== "simpleloop") {
if (this.pid !== "remlen") {
this.drawBGCells();
}

Expand All @@ -567,7 +552,7 @@
if (this.pid === "remlen") {
this.drawBorderDirBG();
}
if (this.pid === "remlen" || this.pid === "simpleloop") {
if (this.pid === "remlen") {
this.drawBGCells();
}
if (
Expand Down Expand Up @@ -607,8 +592,7 @@
if (
this.pid !== "rassi" &&
this.pid !== "doubleback" &&
this.pid !== "nothing" &&
this.pid !== "simpleloop"
this.pid !== "nothing"
) {
this.drawTarget();
}
Expand Down Expand Up @@ -683,26 +667,16 @@
}
}
},
"Graphic@simpleloop": {
getBGCellColor: function(cell) {
return cell.ques === 7 ? "black" : this.getBGCellColor_error1(cell);
}
},
"Graphic@doubleback,rassi,remlen": {
getBGCellColor: function(cell) {
return cell.ques === 7 ? "darkgray" : this.getBGCellColor_error1(cell);
}
},
"Graphic@simpleloop,doubleback,rassi,remlen": {
},
getBorderColor: function(border) {
var cell1 = border.sidecell[0],
cell2 = border.sidecell[1];
if (cell1.ques === 7 && cell2.ques === 7) {
return null;
}
if (this.pid === "simpleloop" && (cell1.ques === 7 || cell2.ques === 7)) {
return null;
}
if (
border.inside &&
!cell1.isnull &&
Expand Down Expand Up @@ -769,9 +743,7 @@
if (this.pid === "ovotovata" || this.pid === "wataridori") {
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
}
if (this.pid !== "simpleloop") {
this.decodeBorder();
}
this.decodeBorder();
if (this.pid === "remlen") {
if (this.outbstr[0] !== "/") {
this.decodeEmpty();
Expand All @@ -795,11 +767,7 @@
this.decodeCircle();
} else if (this.pid === "onsen" || this.pid === "wataridori") {
this.decodeNumber16();
} else if (
this.pid === "doubleback" ||
this.pid === "simpleloop" ||
this.pid === "rassi"
) {
} else if (this.pid === "doubleback" || this.pid === "rassi") {
this.decodeEmpty();
}
},
Expand All @@ -810,9 +778,7 @@
if (this.pid === "ovotovata" || this.pid === "wataridori") {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
}
if (this.pid !== "simpleloop") {
this.encodeBorder();
}
this.encodeBorder();
if (this.pid === "remlen" && !this.encodeEmpty()) {
this.outbstr += "/";
}
Expand All @@ -832,11 +798,7 @@
this.encodeCircle();
} else if (this.pid === "onsen" || this.pid === "wataridori") {
this.encodeNumber16();
} else if (
this.pid === "doubleback" ||
this.pid === "simpleloop" ||
this.pid === "rassi"
) {
} else if (this.pid === "doubleback" || this.pid === "rassi") {
this.encodeEmpty();
}
}
Expand Down Expand Up @@ -884,18 +846,12 @@
if (this.pid === "ovotovata" || this.pid === "wataridori") {
this.decodeConfigFlag("f", "loop_full");
}
if (this.pid !== "simpleloop") {
if (this.filever >= 2) {
this.decodeBorderQues();
} else {
this.decodeAreaRoom();
}
if (this.filever >= 2) {
this.decodeBorderQues();
} else {
this.decodeAreaRoom();
}
if (
this.pid === "doubleback" ||
this.pid === "simpleloop" ||
this.pid === "rassi"
) {
if (this.pid === "doubleback" || this.pid === "rassi") {
this.decodeEmpty();
} else {
this.decodeCellQnum();
Expand All @@ -904,11 +860,7 @@
this.decodeBorderArrowAns();
} else {
this.decodeBorderLine();
if (
this.pid !== "onsen" &&
this.pid !== "simpleloop" &&
this.pid !== "wataridori"
) {
if (this.pid !== "onsen" && this.pid !== "wataridori") {
this.decodeCellQsub();
}
}
Expand All @@ -920,15 +872,9 @@
if (this.pid === "ovotovata" || this.pid === "wataridori") {
this.encodeConfigFlag("f", "loop_full");
}
if (this.pid !== "simpleloop") {
this.filever = 2;
this.encodeBorderQues();
}
if (
this.pid === "doubleback" ||
this.pid === "simpleloop" ||
this.pid === "rassi"
) {
this.filever = 2;
this.encodeBorderQues();
if (this.pid === "doubleback" || this.pid === "rassi") {
this.encodeEmpty();
} else {
this.encodeCellQnum();
Expand All @@ -937,11 +883,7 @@
this.encodeBorderArrowAns();
} else {
this.encodeBorderLine();
if (
this.pid !== "onsen" &&
this.pid !== "simpleloop" &&
this.pid !== "wataridori"
) {
if (this.pid !== "onsen" && this.pid !== "wataridori") {
this.encodeCellQsub();
}
}
Expand Down Expand Up @@ -1052,15 +994,6 @@
"checkRoomPassTwice"
]
},
"AnsCheck@simpleloop#1": {
checklist: [
"checkBranchLine",
"checkCrossLine",
"checkDeadendLine+",
"checkOneLoop",
"checkNoLine"
]
},
"AnsCheck@moonsun#1": {
checklist: [
"checkBranchLine",
Expand Down
98 changes: 98 additions & 0 deletions src/variety/simpleloop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
(function(pidlist, classbase) {
if (typeof module === "object" && module.exports) {
module.exports = [pidlist, classbase];
} else {
pzpr.classmgr.makeCustom(pidlist, classbase);
}
})(["simpleloop"], {
MouseEvent: {
inputModes: {
edit: ["clear", "info-line", "empty"],
play: ["line", "peke", "clear", "info-line"]
},
mouseinputAutoEdit: function() {
this.inputempty();
},

autoplay_func: "line"
},
Cell: {
noLP: function(dir) {
return this.isEmpty();
}
},
Border: {
enableLineNG: true
},
Board: {
hasborder: 1
},
LineGraph: {
enabled: true
},

Graphic: {
irowake: true,

numbercolor_func: "qnum",

gridcolor_type: "SLIGHT",

paint: function() {
this.drawDashedGrid();
this.drawBGCells();

this.drawBorders();

this.drawLines();
this.drawPekes();

this.drawChassis();
},

getBGCellColor: function(cell) {
return cell.ques === 7 ? "black" : this.getBGCellColor_error1(cell);
}
},

Encode: {
decodePzpr: function(type) {
this.decodeEmpty();
},
encodePzpr: function(type) {
this.encodeEmpty();
}
},
FileIO: {
decodeData: function() {
this.decodeEmpty();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeEmpty();
this.encodeBorderLine();
},
decodeEmpty: function() {
this.decodeCell(function(cell, ca) {
if (ca === "*") {
cell.ques = 7;
}
});
},
encodeEmpty: function() {
this.encodeCell(function(cell) {
return cell.ques === 7 ? "* " : ". ";
});
}
},

AnsCheck: {
checklist: [
"checkBranchLine",
"checkCrossLine",
"checkDeadendLine+",
"checkOneLoop",
"checkNoLine"
]
}
});
Loading