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
1 change: 1 addition & 0 deletions src-ui/js/ui/KeyPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ ui.keypopup = {
heavydots: [10, 0],
suguru: [10, 10],
marutaring: [10, 0],
nuriloop: [10, 0],
tetroctb: [10, 0],
hasunomura: [10, 0],
bramble: [10, 0],
Expand Down
1 change: 1 addition & 0 deletions src-ui/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
<li data-pid="morningwalk"></li>
<li data-pid="bhaibahan"></li>
<li data-pid="roboticwalk"></li>
<li data-pid="nuriloop"></li>
</ul>
</div>
<div class="lists loops">
Expand Down
1 change: 1 addition & 0 deletions src/pzpr/variety.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
numrope: [0, 0, "ナンバーロープ", "Number Rope", "kakuru"],
nuribou: [1, 0, "ぬりぼう", "Nuribou", "nurikabe"],
nurikabe: [0, 1, "ぬりかべ", "Nurikabe", "nurikabe"],
nuriloop: [0, 0, "面積リンク", "Nurikabe Loop"],
nurimaze: [0, 0, "ぬりめいず", "Nuri-Maze", "nurimaze"],
nurimisaki: [0, 0, "ぬりみさき", "Nurimisaki", "kurodoko"],
nuritwin: [0, 0, "ぬりツイン", "Nuritwin", "shimaguni"],
Expand Down
160 changes: 160 additions & 0 deletions src/variety/nuriloop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
(function(pidlist, classbase) {
if (typeof module === "object" && module.exports) {
module.exports = [pidlist, classbase];
} else {
pzpr.classmgr.makeCustom(pidlist, classbase);
}
})(["nuriloop"], {
MouseEvent: {
use: true,
inputModes: {
edit: ["number", "clear", "info-line"],
play: ["line", "peke", "subcircle", "subcross", "info-line"]
},
autoedit_func: "qnum",
autoplay_func: "lineMB"
},

KeyEvent: {
enablemake: true
},

Board: {
hasborder: 1
},
Border: {
enableLineNG: true
},
Cell: {
maxnum: function() {
return this.board.cols * this.board.rows;
},
noLP: function() {
return this.isNum();
},
isUnshade: function() {
return this.lcnt === 0;
}
},
LineGraph: {
enabled: true
},
AreaUnshadeGraph: {
enabled: true,
relation: { "border.line": "block" },
modifyOtherInfo: function(border, relation) {
this.setEdgeByNodeObj(border.sidecell[0]);
this.setEdgeByNodeObj(border.sidecell[1]);
}
},

Graphic: {
irowake: true,
gridcolor_type: "LIGHT",
numbercolor_func: "qnum",
qanscolor: "black",

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

this.drawQuesNumbers();

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

this.drawChassis();

this.drawTarget();
}
},

Encode: {
decodePzpr: function(type) {
this.decodeNumber16();
},
encodePzpr: function(type) {
this.encodeNumber16();
}
},
FileIO: {
decodeData: function() {
this.decodeCellQnum();
this.decodeCellQsub();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeCellQnum();
this.encodeCellQsub();
this.encodeBorderLine();
}
},

AnsCheck: {
checklist: [
"checkLineExist+",
"checkBranchLine",
"checkCrossLine",
"checkLineOverlap",

"checkNoNumberInUnshade",
"checkDoubleNumberInUnshade",
"checkNumberAndUnshadeSize",

"checkDeadendLine+",
"checkOneLoop"
],

checkLineOverlap: function() {
this.checkAllCell(function(cell) {
return cell.lcnt > 0 && cell.qnum !== -1;
}, "lnOverlap");
},

checkDoubleNumberInUnshade: function() {
this.checkAllBlock(
this.board.ublkmgr,
function(cell) {
return cell.isNum();
},
function(w, h, a, n) {
return a < 2;
},
"bkNumGe2"
);
},
checkNumberAndUnshadeSize: function() {
this.checkAllCell(function(cell) {
if (!cell.isValidNum()) {
return false;
}
if (!cell.ublk) {
return true;
}

if (cell.ublk.clist.length !== cell.getNum()) {
cell.ublk.clist.seterr(1);
return true;
}
return false;
}, "bkSizeNe");
},

checkNoNumberInUnshade: function() {
this.checkAllBlock(
this.board.ublkmgr,
function(cell) {
return cell.isNum();
},
function(w, h, a, n) {
return a !== 0;
},
"bkNoNum"
);
}
},
FailCode: {
lnOverlap: "lnOverlap.tontti"
}
});
48 changes: 48 additions & 0 deletions test/script/nuriloop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* nuriloop.js */

ui.debug.addDebugData("nuriloop", {
url: "5/5/4m2m1n",
failcheck: [
[
"brNoLine",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /"
],
[
"lnBranch",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 /0 0 0 0 /0 1 1 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 0 /0 0 1 0 0 /0 0 0 0 0 /0 0 0 0 0 /"
],
[
"lnCross",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 0 0 /0 0 1 1 /0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 1 0 /0 0 0 1 0 /"
],
[
"lnPlLoop",
"pzprv3/nuriloop/5/5/3 . . . . /. . . 1 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 /0 1 0 0 /1 0 1 1 /0 0 0 1 /1 1 0 1 /0 0 1 0 1 /0 1 0 0 1 /1 0 1 0 0 /1 0 1 1 1 /"
],
[
"lnOverlap",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 1 1 1 /1 0 0 0 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 1 0 0 0 /"
],
[
"bkNoNum",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 1 1 /1 1 0 0 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 0 0 /"
],
[
"bkNumGe2",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 0 0 /1 1 1 1 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 0 0 1 /"
],
[
"bkSizeNe",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 1 1 1 /0 1 0 0 /1 1 0 0 /0 0 1 0 /1 1 0 1 /0 1 0 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 1 1 /"
],
[
"lnDeadEnd",
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 1 0 /1 0 1 1 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 0 1 /"
],
[
null,
"pzprv3/nuriloop/5/5/4 . . . . /. . . 2 . /. . . . . /. 1 . . . /. . . . . /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 0 0 0 /0 0 1 1 /0 0 0 0 /1 1 0 0 /0 0 1 0 /1 1 0 1 /0 0 1 0 1 /0 0 1 0 1 /1 0 0 0 1 /1 0 1 1 1 /"
]
],
inputs: []
});
Loading