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-ui/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<main>
<div style="margin-bottom: 5px;"><b>Latest types</b> (<em><a href="/list.html" target="_parent">all types</a></em>)</div>
<ul>
<li><a href="/p?lring" target="_parent">L-Ring えるりんぐ</a></li>
<li><a href="/p?gravel" target="_parent">Gravel</a></li>
<li><a href="/p?scrabble" target="_parent">Scrabble</a></li>
<li><a href="/p?vertigo" target="_parent">Vertigo</a></li>
<li><a href="/p?mrokmrno" target="_parent">Mr. OK and Mr. NO</a></li>
<li><a href="/p?slovak" target="_parent">Slovak Sums</a></li>
<li><a href="/p?anymino" target="_parent">Anymino</a></li>
<li><a href="/p?elasticlink" target="_parent">Elastic Link</a></li>
</ul>
</main>
</body>
1 change: 1 addition & 0 deletions src-ui/js/ui/MenuConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
case "wataridori":
case "bhaibahan":
case "bwloop":
case "lring":
idname = "loop_full";
break;
}
Expand Down
1 change: 1 addition & 0 deletions src-ui/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
<li data-pid="roboticwalk"></li>
<li data-pid="nuriloop"></li>
<li data-pid="bwloop"></li>
<li data-pid="lring"></li>
</ul>
</div>
<div class="lists loops">
Expand Down
3 changes: 2 additions & 1 deletion src/puzzle/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@
"roboticwalk",
"wataridori",
"bhaibahan",
"bwloop"
"bwloop",
"lring"
].indexOf(pid) >= 0;
break;
default:
Expand Down
1 change: 1 addition & 0 deletions src/pzpr/variety.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
lookair: [0, 0, "るっくえあ", "Look-Air"],
loopsp: [1, 0, "環状線スペシャル", "Loop Special", "pipelink"],
loute: [0, 0, "エルート", "L-route"],
lring: [0, 0, "えるりんぐ", "L-Ring", "balance"],
magnets: [0, 0, "Magnets", "Magnets"],
makaro: [0, 0, "マカロ", "Makaro"],
mannequin: [0, 0, "マネキンゲート", "Mannequin Gate"],
Expand Down
3 changes: 3 additions & 0 deletions src/res/failcode.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"arDistanceNe.myopia": "The lines pointed to by a clue are at different distances.",
"arDistanceNe.pentopia": "The shaded cells pointed to by a clue are at different distances.",
"arInvalid.evolmino": "The arrow is invalid.",
"arHatenaNe.lring": "The line segments connected to a question mark don't have a length difference of 1.",
"arLengthNe.lring": "An arrow does not point to a line segment that's 1 cell longer than the other line segment.",
"arNoLine.lring": "A clue cell does not have a turn.",
"arNoLine": "A line doesn't go through some arrows.",
"arNoLineSeen": "There is no line in the direction of an arrow.",
"arNoShade.distopia": "A number cannot see any shaded cells.",
Expand Down
204 changes: 169 additions & 35 deletions src/variety/balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,27 @@
} else {
pzpr.classmgr.makeCustom(pidlist, classbase);
}
})(["balance"], {
})(["balance", "lring"], {
MouseEvent: {
inputModes: {
edit: ["number", "shade", "clear"],
play: ["line", "peke", "info-line"]
},
mouseinput_auto: function() {
if (this.puzzle.playmode) {
if (this.mousestart || this.mousemove) {
if (this.btn === "left") {
this.inputLine();
} else if (this.btn === "right") {
this.inputpeke();
}
} else if (this.mouseend && this.notInputted()) {
if (this.inputpeke_ifborder()) {
return;
}
autoplay_func: "line",
mouseinputAutoEdit: function() {
if (this.mousestart) {
var cell = this.getcell();
if (cell.isnull) {
return;
}
} else if (this.puzzle.editmode) {
if (this.mousestart) {
var cell = this.getcell();
if (cell.isnull) {
if (cell === this.cursor.getc() || this.btn === "left") {
this.inputqnum();
} else {
if (cell.qnum === -1) {
return;
}
if (cell === this.cursor.getc() || this.btn === "left") {
this.inputqnum();
} else {
if (cell.qnum === -1) {
return;
}
cell.ques = 1 - cell.ques;
cell.draw();
}
cell.ques = 1 - cell.ques;
cell.draw();
}
}
},
Expand All @@ -58,6 +45,15 @@
}
}
},
"MouseEvent@lring": {
mouseinputAutoEdit: function() {
if (this.mousestart || this.mousemove) {
this.inputarrow_cell();
} else if (this.mouseend && this.notInputted()) {
this.inputqnum();
}
}
},
KeyEvent: {
enablemake: true,

Expand Down Expand Up @@ -89,6 +85,34 @@
}
}
},
"KeyEvent@lring": {
moveTarget: function(ca) {
if (ca.match(/shift/)) {
return false;
}
return this.moveTCell(ca);
},

keyinput: function(ca) {
this.key_toichika(ca);
},
key_toichika: function(ca) {
if (ca === "1" || ca === "w" || ca === "shift+up") {
ca = "1";
} else if (ca === "2" || ca === "s" || ca === "shift+right") {
ca = "4";
} else if (ca === "3" || ca === "z" || ca === "shift+down") {
ca = "2";
} else if (ca === "4" || ca === "a" || ca === "shift+left") {
ca = "3";
} else if (ca === "5" || ca === "q" || ca === "-") {
ca = "s1";
} else if (ca === "6" || ca === "e" || ca === " ") {
ca = " ";
}
this.key_inputqnum(ca);
}
},

Cell: {
counted: false,
Expand Down Expand Up @@ -142,11 +166,18 @@
}

var lengths = [];
this.horizlength = 0;
this.vertlength = 0;
for (var dir = 1; dir <= 4; dir++) {
var l = this.getSegmentDir(dir).length;
if (l > 0) {
lengths.push(l);
}
if (dir === this.UP || dir === this.DN) {
this.vertlength += l;
} else {
this.horizlength += l;
}
}
if (lengths[0] === lengths[1]) {
this.equalsegments = true;
Expand All @@ -161,6 +192,10 @@
this.counted = false;
}
},
"Cell@lring": {
numberAsObject: true,
maxnum: 4
},
Border: {
posthook: {
line: function() {
Expand All @@ -181,6 +216,11 @@
}
}
},
"BoardExec@lring": {
adjustBoardData: function(key, d) {
this.adjustCellArrow(key, d);
}
},
Board: {
hasborder: 1,

Expand All @@ -197,14 +237,16 @@
enabled: true
},

"Graphic@balance": {
hideHatena: true,
textoption: { ratio: 0.65 }
},
Graphic: {
irowake: true,

numbercolor_func: "qnum",
gridcolor_type: "LIGHT",

hideHatena: true,

circleratio: [0.4, 0.35],

getCircleFillColor: function(cell) {
Expand All @@ -224,17 +266,20 @@
return cell.ques === 0 ? "black" : "white";
},

textoption: { ratio: 0.65 },

minYdeg: 0.36,
maxYdeg: 0.74,

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

this.drawCircles();
this.drawQuesNumbers();
if (this.pid === "lring") {
this.drawCellArrows(true);
this.drawHatenas();
} else {
this.drawCircles();
this.drawQuesNumbers();
}
this.drawLines();

this.drawPekes();
Expand All @@ -243,7 +288,7 @@
}
},

Encode: {
"Encode@balance": {
decodePzpr: function(type) {
var c = 0,
i = 0,
Expand Down Expand Up @@ -312,7 +357,17 @@
this.outbstr += cm;
}
},
FileIO: {
"Encode@lring": {
decodePzpr: function() {
this.decode4Cell();
this.puzzle.setConfig("loop_full", this.checkpflag("f"));
},
encodePzpr: function() {
this.outpflag = this.puzzle.getConfig("loop_full") ? "f" : null;
this.encode4Cell();
}
},
"FileIO@balance": {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeCell(function(cell, ca) {
Expand All @@ -337,8 +392,20 @@
this.encodeBorderLine();
}
},
"FileIO@lring": {
decodeData: function() {
this.decodeConfigFlag("f", "loop_full");
this.decodeCellQnum();
this.decodeBorderLine();
},
encodeData: function() {
this.encodeConfigFlag("f", "loop_full");
this.encodeCellQnum();
this.encodeBorderLine();
}
},

AnsCheck: {
"AnsCheck@balance": {
checklist: [
"checkBranchLine",
"checkCrossLine",
Expand Down Expand Up @@ -417,5 +484,72 @@
return cell.isNum() && cell.lcnt === 0;
}, "circNoLine");
}
},

"AnsCheck@lring": {
checklist: [
"checkBranchLine",
"checkCrossLine",
"checkTurnOnArrow",
"checkLengthInArrowDir",
"checkLengthInHatena",
"checkDeadendLine+",
"checkOneLoop",
"checkNoLineIfVariant"
],

checkTurnOnArrow: function() {
this.checkAllCell(function(cell) {
return cell.isNum() && !cell.isLineCurve();
}, "arNoLine");
},

checkLengthInArrowDir: function() {
var borders = this.board.border;

this.checkAllCell(function(cell) {
if (!cell.isValidNum() || !cell.isLineCurve()) {
return false;
}

var addr = cell.getaddr();
addr.movedir(cell.qnum, 1);
var border = addr.getb();
if (!border.isLine()) {
return true;
}

cell.recount();
if (
border.isVert()
? cell.horizlength !== cell.vertlength + 1
: cell.vertlength !== cell.horizlength + 1
) {
borders.setnoerr();
cell.getAllSegments().seterr(1);
return true;
}

return false;
}, "arLengthNe");
},

checkLengthInHatena: function() {
var borders = this.board.border;

this.checkAllCell(function(cell) {
if (cell.qnum !== -2 || cell.lcnt !== 2) {
return false;
}

cell.recount();
if (Math.abs(cell.horizlength - cell.vertlength) !== 1) {
borders.setnoerr();
cell.getAllSegments().seterr(1);
return true;
}
return false;
}, "arHatenaNe");
}
}
});
Loading
Loading