Skip to content

Commit 9c9398d

Browse files
committed
lapaz: Add Liar variant
1 parent f1836ce commit 9c9398d

5 files changed

Lines changed: 45 additions & 6 deletions

File tree

src-ui/js/ui/MenuConfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@
152152
case "fillomino":
153153
idname = "fillomino_tri";
154154
break;
155+
case "lapaz":
156+
idname = "lapaz_liar";
157+
break;
155158
case "trizone":
156159
idname = "trizone_ghost";
157160
break;

src-ui/p.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ <h2 id="title2">読み込み中です...</h2>
472472
<span>__trizone_ghost__</span>
473473
</label>
474474
</div>
475+
<div class="config" data-config="lapaz_liar">
476+
<label>
477+
<input type="checkbox">
478+
<span>__lapaz_liar__</span>
479+
</label>
480+
</div>
475481
<div class="config" data-config="slither_full">
476482
<label>
477483
<input type="checkbox">

src-ui/res/p.en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"aqre_borders": "Borders must touch exactly one shaded cell",
212212
"fillomino_tri": "Maximum block size is 3",
213213
"trizone_ghost": "Regions can have no clues",
214+
"lapaz_liar": "Liar (clues can be erased by shading)",
214215
"slither_full": "All points must be visited",
215216
"loop_full": "All cells must be visited",
216217
"variant": "This puzzle uses variant rules",

src/puzzle/Config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
variant: true,
158158
volatile: true
159159
}); /* Groups may have no number */
160+
this.add("lapaz_liar", false, {
161+
variant: true,
162+
volatile: true
163+
}); /* Clues may be erased by shading over them */
160164
this.add("slither_full", false, {
161165
variant: true,
162166
volatile: true
@@ -538,6 +542,9 @@
538542
"lineofsight"
539543
].indexOf(pid) >= 0;
540544
break;
545+
case "lapaz_liar":
546+
exec = pid === "lapaz";
547+
break;
541548
case "trizone_ghost":
542549
exec = pid === "trizone";
543550
break;

src/variety/lapaz.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,17 @@
110110
numberRemainsUnshaded: true,
111111

112112
maxnum: function() {
113-
return Math.max(this.board.cols, this.board.rows) >> 1;
113+
var liar = this.puzzle.getConfig("lapaz_liar") ? 1 : 0;
114+
return liar + (Math.max(this.board.cols, this.board.rows) >> 1);
114115
},
115116
minnum: 0,
116117

117118
allowUnshade: function() {
118119
return this.isValid();
119120
},
120121
allowShade: function() {
121-
return this.isValid() && !this.isNum();
122+
var isLiar = this.puzzle.getConfig("lapaz_liar");
123+
return this.isValid() && (isLiar || !this.isNum());
122124
},
123125

124126
posthook: {
@@ -265,24 +267,40 @@
265267
decodePzpr: function(type) {
266268
this.decodeNumber16();
267269
this.decodeEmpty();
268-
this.puzzle.setConfig("trizone_ghost", this.checkpflag("g"));
270+
if (this.pid === "lapaz") {
271+
this.puzzle.setConfig("lapaz_liar", this.checkpflag("l"));
272+
} else {
273+
this.puzzle.setConfig("trizone_ghost", this.checkpflag("g"));
274+
}
269275
},
270276
encodePzpr: function(type) {
271-
this.outpflag = this.puzzle.getConfig("trizone_ghost") ? "g" : null;
277+
if (this.pid === "lapaz") {
278+
this.outpflag = this.puzzle.getConfig("lapaz_liar") ? "l" : null;
279+
} else {
280+
this.outpflag = this.puzzle.getConfig("trizone_ghost") ? "g" : null;
281+
}
272282
this.encodeNumber16();
273283
this.encodeEmpty();
274284
}
275285
},
276286
//---------------------------------------------------------
277287
FileIO: {
278288
decodeData: function() {
279-
this.decodeConfigFlag("g", "trizone_ghost");
289+
if (this.pid === "lapaz") {
290+
this.decodeConfigFlag("l", "lapaz_liar");
291+
} else {
292+
this.decodeConfigFlag("g", "trizone_ghost");
293+
}
280294
this.decodeCellQnum();
281295
this.decodeBorderAns(1);
282296
this.decodeCellAns();
283297
},
284298
encodeData: function() {
285-
this.encodeConfigFlag("g", "trizone_ghost");
299+
if (this.pid === "lapaz") {
300+
this.encodeConfigFlag("l", "lapaz_liar");
301+
} else {
302+
this.encodeConfigFlag("g", "trizone_ghost");
303+
}
286304
this.encodeCellQnum();
287305
this.encodeBorderAns(1);
288306
this.encodeCellAns();
@@ -335,6 +353,10 @@
335353
},
336354

337355
checkNumberRegionSize: function() {
356+
if (this.puzzle.getConfig("lapaz_liar")) {
357+
return;
358+
}
359+
338360
this.checkAllCell(function(cell) {
339361
return cell.qnum !== -1 && cell.room.clist.length === 1;
340362
}, "nmLt1");

0 commit comments

Comments
 (0)