Skip to content

Commit 29c77ce

Browse files
committed
Add connectivity
1 parent a83a4cc commit 29c77ce

2 files changed

Lines changed: 51 additions & 5 deletions

File tree

src/res/failcode.en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@
648648
"lnPassOver.kouchoku": "A segment passes over a clue.",
649649
"lnPlLine": "There are multiple lines.",
650650
"lnPlLoop.crossstitch": "There aren't exactly two loops.",
651+
"lnPlLoop.diamond": "Not all shaded cells and diamonds are connected.",
651652
"lnPlLoop.forestwalk": "There are multiple networks.",
652653
"lnPlLoop.ladders": "Not all regions are connected.",
653654
"lnPlLoop.tajmahal": "There is a square that is not connected to the other squares.",

src/variety/diamond.js

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
MouseEvent: {
99
use: true,
1010
inputModes: {
11-
edit: ["number", "clear"],
12-
play: ["pin", "peke", "clear"]
11+
edit: ["number", "clear", "info-blk"],
12+
play: ["pin", "peke", "clear", "info-blk"]
1313
},
1414

1515
mouseinput_auto: function() {
@@ -24,6 +24,24 @@
2424
}
2525
},
2626

27+
dispInfoBlk: function() {
28+
var cell = this.getcell();
29+
var crosses = cell.dotCrosses();
30+
var cross = cell.isNum()
31+
? crosses[0]
32+
: crosses.filter(function(c) {
33+
return c.qans === 1;
34+
})[0];
35+
36+
this.mousereset();
37+
if (!cross || !cross.dblk) {
38+
return;
39+
}
40+
cross.dblk.clist.setinfo(1);
41+
this.board.hasinfo = true;
42+
this.puzzle.redraw();
43+
},
44+
2745
mouseinput_other: function() {
2846
if (this.inputMode === "pin") {
2947
this.inputdot(1);
@@ -243,6 +261,23 @@
243261
this.drawTarget();
244262
},
245263

264+
getQuesCellColor: function(cell) {
265+
if (cell.qnum === -1) {
266+
return null;
267+
}
268+
var err = cell.error || cell.qinfo;
269+
if (!err) {
270+
var cross = cell.dotCrosses().filter(function(c) {
271+
return c.error || c.qinfo;
272+
})[0];
273+
err = cross ? cross.error || cross.qinfo : 0;
274+
}
275+
if (err === 1) {
276+
return this.errcolor1;
277+
}
278+
return this.quescolor;
279+
},
280+
246281
getQuesNumberColor: function(cell) {
247282
return cell.qcmp === 1 ? this.qcmpcolor : this.fontShadecolor;
248283
},
@@ -295,9 +330,10 @@
295330
if (!dot.qans) {
296331
return this.pekecolor;
297332
}
298-
return dot.error === 1
333+
var err = dot.error || dot.qinfo;
334+
return err === 1
299335
? this.errcolor1
300-
: dot.error === -1
336+
: err === -1
301337
? this.noerrcolor
302338
: this.qanscolor;
303339
}
@@ -327,7 +363,16 @@
327363
}
328364
},
329365
AnsCheck: {
330-
checklist: ["checkOverlap", "checkDir4DiamondOver", "checkDir4DiamondLess"],
366+
checklist: [
367+
"checkOverlap",
368+
"checkDir4DiamondOver",
369+
"checkDir4DiamondLess",
370+
"checkDiamondConnect+"
371+
],
372+
373+
checkDiamondConnect: function() {
374+
this.checkOneArea(this.board.diamondgraph, "lnPlLoop");
375+
},
331376

332377
checkOverlap: function() {
333378
for (var c = 0; c < this.board.cross.length; c++) {

0 commit comments

Comments
 (0)