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 @@ -248,6 +248,7 @@ ui.keypopup = {
bhaibahan: [10, 0],
edamame: [4, 0],
heavydots: [10, 0],
suguru: [10, 10],
marutaring: [10, 0],
tetroctb: [10, 0],
hasunomura: [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 @@ -376,6 +376,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
<li data-pid="twinarea"></li>
<li data-pid="numcity"></li>
<li data-pid="topo"></li>
<li data-pid="suguru"></li>
</ul>
</div>
<div class="lists others">
Expand Down
1 change: 1 addition & 0 deletions src/pzpr/variety.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@
stostone: [0, 0, "ストストーン", "Stostone", "shimaguni"],
subomino: [0, 0, "Subomino", "Subomino", "nawabari"],
sudoku: [0, 1, "数独", "Sudoku"],
suguru: [0, 0, "ナンバーブロック", "Suguru (Capsules)", "ripple"],
sukoro: [1, 0, "数コロ", "Sukoro", "sukoro"],
sukororoom: [0, 0, "数コロ部屋", "Sukoro-room", "sukoro"],
sumiwake: [0, 0, "すみわけ", "Sumiwake", "heyawake"],
Expand Down
72 changes: 66 additions & 6 deletions src/variety/ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
} else {
pzpr.classmgr.makeCustom(pidlist, classbase);
}
})(["ripple", "cojun", "meander"], {
})(["ripple", "cojun", "meander", "suguru"], {
//---------------------------------------------------------
// マウス入力系
MouseEvent: {
inputModes: {
edit: ["border", "number", "clear"],
edit: ["border", "empty", "number", "clear"],
play: ["number", "clear"]
},
autoedit_func: "areanum",
autoplay_func: "qnum"
},
"MouseEvent@meander": {
inputModes: {
edit: ["border", "number", "clear"],
edit: ["border", "empty", "number", "clear"],
play: ["number", "dragnum+", "dragnum-", "clear"]
},
mouseinput: function() {
Expand Down Expand Up @@ -106,7 +106,18 @@
// キーボード入力系
KeyEvent: {
enablemake: true,
enableplay: true
enableplay: true,

keyinput: function(ca) {
if ((ca === "q" || ca === "w") && this.puzzle.editmode) {
var cell = this.cursor.getc();
if (!cell.isnull) {
cell.setValid(cell.ques !== 7 ? 7 : 0);
}
} else {
this.key_inputqnum(ca);
}
}
},

//---------------------------------------------------------
Expand All @@ -117,10 +128,17 @@
return this.room.clist.length;
}
},
Border: {
isQuesBorder: function() {
return (
this.ques || this.sidecell[0].isEmpty() || this.sidecell[1].isEmpty()
);
}
},
Board: {
hasborder: 1
},
"Board@cojun": {
"Board@cojun,suguru": {
cols: 8,
rows: 8
},
Expand All @@ -139,6 +157,13 @@
Graphic: {
gridcolor_type: "DLIGHT",

getBGCellColor: function(cell) {
if (!cell.isValid()) {
return "black";
}
return this.getBGCellColor_error1(cell);
},

paint: function() {
this.drawBGCells();
this.drawTargetSubNumber();
Expand All @@ -153,6 +178,14 @@
this.drawChassis();

this.drawCursor();
},

getBorderColor: function(border) {
if (border.isQuesBorder()) {
return border.error === 1 ? this.errcolor1 : "black";
}

return this.getBorderColor_qans(border);
}
},

Expand All @@ -162,10 +195,12 @@
decodePzpr: function(type) {
this.decodeBorder();
this.decodeNumber16();
this.decodeEmpty();
},
encodePzpr: function(type) {
this.encodeBorder();
this.encodeNumber16();
this.encodeEmpty();
},

decodeKanpen: function() {
Expand Down Expand Up @@ -212,6 +247,31 @@
this.encodeCellAnum_XMLAnswer();
},

decodeCellQnum: function() {
this.decodeCell(function(cell, ca) {
if (ca === "#") {
cell.ques = 7;
} else if (ca === "-") {
cell.qnum = -2;
} else if (ca !== ".") {
cell.qnum = +ca;
}
});
},
encodeCellQnum: function() {
this.encodeCell(function(cell) {
if (cell.ques === 7) {
return "# ";
} else if (cell.qnum >= 0) {
return cell.qnum + " ";
} else if (cell.qnum === -2) {
return "- ";
} else {
return ". ";
}
});
},

UNDECIDED_NUM_XML: 0
},

Expand All @@ -223,7 +283,7 @@
"checkRippleNumber@ripple",
"checkAdjacentDiffNumber@cojun",
"checkUpperNumber@cojun",
"checkAdjacentNumbers@meander",
"checkAdjacentNumbers@meander,suguru",
"checkConsecutiveNeighbors@meander",
"checkNoNumCell+"
],
Expand Down
24 changes: 24 additions & 0 deletions test/script/suguru.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* suguru.js */

ui.debug.addDebugData("suguru", {
url: "5/5/cih47bs73m3g5p1g2g",
failcheck: [
[
"bkDupNum",
"pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. . . . . /. . 1 . 4 /. 3 2 . . /2 4 5 . . /3 . 3 . 1 /"
],
[
"nmAround",
"pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. . 1 . . /. 1 . . 1 /. . . . . /. . . . . /. . . . . /"
],
[
"ceNoNum",
"pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. . 1 2 1 /1 . . . . /. 2 1 2 1 /. . . 4 3 /. . 3 . 1 /"
],
[
null,
"pzprv3/suguru/5/5/0 1 1 0 /0 1 0 0 /1 0 1 0 /0 0 1 0 /0 1 0 0 /0 0 1 1 1 /0 1 0 1 1 /1 1 1 0 0 /0 0 1 1 1 /3 . . . . /. . . 3 . /5 . . . . /. . . . . /. 1 . 2 . /. 2 1 2 1 /1 4 5 . 4 /. 2 1 2 1 /3 4 5 4 3 /2 . 3 . 1 /"
]
],
inputs: []
});
Loading