Skip to content

Commit 6f964a1

Browse files
authored
Add The Longest
1 parent f789fe5 commit 6f964a1

8 files changed

Lines changed: 411 additions & 99 deletions

File tree

src-ui/list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
327327
<li data-pid="tetrominous"></li>
328328
<li data-pid="voxas"></li>
329329
<li data-pid="narrow"></li>
330+
<li data-pid="longest"></li>
330331
</ul>
331332
</div>
332333
<div class="lists divides">

src/pzpr/variety.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@
279279
lixloop: [0, 0, "LIX Loop", "LIX Loop", "yajilin"],
280280
lohkous: [0, 0, "Lohkous", "Lohkous"],
281281
lollipops: [0, 0, "ペロペロキャンディ", "Lollipops"],
282+
longest: [0, 0, "短辺消失", "The Longest"],
282283
lookair: [0, 0, "るっくえあ", "Look-Air"],
283284
loopsp: [1, 0, "環状線スペシャル", "Loop Special", "pipelink"],
284285
loute: [0, 0, "エルート", "L-route"],

src/res/failcode.en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@
7171
"bdDeadEnd": "There is a dead-end line.",
7272
"bdDoorsGt.oneroom": "Two rooms have more than one door between them.",
7373
"bdEqual.antmill": "A square clue does not overlap two cells of the same color.",
74+
"bdGivenUnused.longest": "A given line is not part of the longest border of an adjacent block.",
7475
"bdIgnoreBP.bdblock": "A point has no line.",
7576
"bdIgnoreBP.kramma": "A point has no line.",
7677
"bdNotChassis.shwolf": "A line doesn't connect to the chassis.",
78+
"bdNotGiven.longest": "A region's longest border uses non-given lines.",
7779
"bdPassStar.nuriuzu": "A star overlaps a shaded cell.",
7880
"bdPassStar.tentaisho": "A line goes over a star.",
7981
"bdPierceGt1.blindrush": "A network of walls is pierced more than once.",
@@ -196,6 +198,7 @@
196198
"bkNotAllMUPassed.dotchi2": "A line doesn't pass all white pearls.",
197199
"bkNotAllMUPassed.moonsun": "A line doesn't pass all of the marks of the sun.",
198200
"bkNotClosed.balloon": "A balloon is not enclosed by borders.",
201+
"bkNotClosed.longest": "A region is not enclosed by borders.",
199202
"bkNotHRect.tatamibari": "A tatami is not a horizontally long rectangle.",
200203
"bkNotLshape.loute": "An area is not L-shaped or its width is not 1.",
201204
"bkNotLshape3.shikaku": "An area whose size is a multiple of three is not L-shaped.",

src/variety-common/Encode.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,59 @@ pzpr.classmgr.makeCommon({
671671
this.outbstr += cm;
672672
},
673673

674+
decodeOuterBorder: function() {
675+
var bstr = this.outbstr,
676+
bd = this.board,
677+
twi = [16, 8, 4, 2, 1];
678+
var pos = bstr
679+
? Math.min(((bd.border.length + 4) / 5) | 0, bstr.length)
680+
: 0,
681+
id = 0;
682+
for (var i = 0; i < pos; i++) {
683+
var ca = parseInt(bstr.charAt(i), 32);
684+
for (var w = 0; w < 5; w++) {
685+
if (!!bd.border[id]) {
686+
bd.border[id].ques = ca & twi[w] ? 1 : 0;
687+
id++;
688+
}
689+
}
690+
}
691+
this.outbstr = bstr.substr(pos);
692+
},
693+
encodeOuterBorder: function() {
694+
var hasoutside = 0,
695+
bd = this.board;
696+
var bdinside = 2 * bd.cols * bd.rows - bd.cols - bd.rows;
697+
for (var id = bdinside; id < bd.border.length && !hasoutside; id++) {
698+
if (bd.border[id].isLineNG()) {
699+
hasoutside = true;
700+
}
701+
}
702+
var num = 0,
703+
pass = 0,
704+
cm = "",
705+
twi = [16, 8, 4, 2, 1];
706+
for (
707+
var id = 0, max = !hasoutside ? bdinside : bd.border.length;
708+
id < max;
709+
id++
710+
) {
711+
if (bd.border[id].isLineNG()) {
712+
pass += twi[num];
713+
}
714+
num++;
715+
if (num === 5) {
716+
cm += pass.toString(32);
717+
num = 0;
718+
pass = 0;
719+
}
720+
}
721+
if (num > 0) {
722+
cm += pass.toString(32);
723+
}
724+
this.outbstr += cm;
725+
},
726+
674727
//---------------------------------------------------------------------------
675728
// enc.decodeCrossMark() 黒点をデコードする
676729
// enc.encodeCrossMark() 黒点をエンコードする

src/variety/cbblock.js

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -463,52 +463,10 @@
463463
// URLエンコード/デコード処理
464464
"Encode@cbblock": {
465465
decodePzpr: function(type) {
466-
this.decodeCBBlock();
466+
this.decodeOuterBorder();
467467
},
468468
encodePzpr: function(type) {
469-
this.encodeCBBlock();
470-
},
471-
472-
decodeCBBlock: function() {
473-
var bstr = this.outbstr,
474-
bd = this.board,
475-
twi = [16, 8, 4, 2, 1];
476-
var pos = bstr
477-
? Math.min(((bd.border.length + 4) / 5) | 0, bstr.length)
478-
: 0,
479-
id = 0;
480-
for (var i = 0; i < pos; i++) {
481-
var ca = parseInt(bstr.charAt(i), 32);
482-
for (var w = 0; w < 5; w++) {
483-
if (!!bd.border[id]) {
484-
bd.border[id].ques = ca & twi[w] ? 1 : 0;
485-
id++;
486-
}
487-
}
488-
}
489-
this.outbstr = bstr.substr(pos);
490-
},
491-
encodeCBBlock: function() {
492-
var num = 0,
493-
pass = 0,
494-
cm = "",
495-
bd = this.board,
496-
twi = [16, 8, 4, 2, 1];
497-
for (var id = 0, max = bd.border.length; id < max; id++) {
498-
if (bd.border[id].isGround()) {
499-
pass += twi[num];
500-
}
501-
num++;
502-
if (num === 5) {
503-
cm += pass.toString(32);
504-
num = 0;
505-
pass = 0;
506-
}
507-
}
508-
if (num > 0) {
509-
cm += pass.toString(32);
510-
}
511-
this.outbstr += cm;
469+
this.encodeOuterBorder();
512470
}
513471
},
514472

0 commit comments

Comments
 (0)