From 4561d5f06e31b00da70a20d5f59707df0c6812fe Mon Sep 17 00:00:00 2001 From: ReverM Date: Mon, 23 Feb 2026 15:17:44 -0500 Subject: [PATCH 1/2] Change behaviour of colored completed clues for kuro-tasq --- src/variety/kurotto.js | 15 +++++++++++++++ src/variety/tasquare.js | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/variety/kurotto.js b/src/variety/kurotto.js index 86ca126ed..cee0cd87c 100644 --- a/src/variety/kurotto.js +++ b/src/variety/kurotto.js @@ -70,6 +70,14 @@ minnum: 0, + allowShade: function() { + return !(this.isValidNum() || this.qnum === -2); + }, + + allowUnshade: function() { + return !(this.isValidNum() || this.qnum === -2); + }, + isCmp: function() { if (!(this.qnum === -2 || this.isValidNum())) { return false; @@ -105,6 +113,13 @@ for (var i = 0; i < list.length; i++) { var area = list[i][0].sblk; if (area !== null) { + for (var j = 0; j < area.clist.length; j++) { + for (var k = 0; k < area.clist[j].getdir4clist().length; k++) { + if (!area.clist[j].getdir4clist()[k][0].isShadeDecided()) { + return false; + } + } + } for (var j = 0; j < arealist.length; j++) { if (arealist[j] === area) { area = null; diff --git a/src/variety/tasquare.js b/src/variety/tasquare.js index b4a297d26..8ec60cc48 100644 --- a/src/variety/tasquare.js +++ b/src/variety/tasquare.js @@ -65,6 +65,14 @@ return this.checkComplete(); }, + allowShade: function() { + return !this.isNum(); + }, + + allowUnshade: function() { + return !this.isNum(); + }, + checkComplete: function() { if (!this.isNum()) { return true; @@ -75,6 +83,13 @@ for (var i = 0; i < list.length; i++) { var block = list[i][0].sblk; if (block !== null) { + for (var j = 0; j < block.clist.length; j++) { + for (var k = 0; k < block.clist[j].getdir4clist().length; k++) { + if (!block.clist[j].getdir4clist()[k][0].isShadeDecided()) { + return false; + } + } + } var shape = block.clist.getRectSize(); if ( shape.cnt !== shape.cols * shape.rows || From 252ff1b879c325560257c5affae29b0e7e89039a Mon Sep 17 00:00:00 2001 From: ReverM Date: Tue, 24 Feb 2026 15:10:06 -0500 Subject: [PATCH 2/2] Adressed some of the comments There's still a failing test, unsure what's up with it --- src/variety/kurotto.js | 107 +++++++++++++++++++++++++--------------- src/variety/tasquare.js | 35 ++++++++++--- 2 files changed, 93 insertions(+), 49 deletions(-) diff --git a/src/variety/kurotto.js b/src/variety/kurotto.js index cee0cd87c..14e94d0da 100644 --- a/src/variety/kurotto.js +++ b/src/variety/kurotto.js @@ -70,14 +70,6 @@ minnum: 0, - allowShade: function() { - return !(this.isValidNum() || this.qnum === -2); - }, - - allowUnshade: function() { - return !(this.isValidNum() || this.qnum === -2); - }, - isCmp: function() { if (!(this.qnum === -2 || this.isValidNum())) { return false; @@ -88,7 +80,7 @@ if (!this.puzzle.execConfig("autocmp")) { return false; } - return this.checkComplete(); + return this.checkComplete() && this.checkUnambiguous(); } }, "Board@island": { @@ -96,7 +88,52 @@ this.islandgraph = this.addInfoList(this.klass.AreaIslandGraph); } }, + + "Cell@mines": { + maxnum: 8, + + checkComplete: function() { + if (!this.isValidNum()) { + return true; + } + + var cnt = 0; + var cells = [ + this.relcell(-2, -2), + this.relcell(0, -2), + this.relcell(2, -2), + this.relcell(-2, 0), + this.relcell(2, 0), + this.relcell(-2, 2), + this.relcell(0, 2), + this.relcell(2, 2) + ]; + for (var i = 0; i < 8; i++) { + if ( + cells[i].group === "cell" && + !cells[i].isnull && + cells[i].isShade() + ) { + cnt++; + } + } + return this.qnum === cnt; + }, + + checkUnambiguous: function() { + return true; + } + }, + "Cell@kurotto,island": { + allowShade: function() { + return !(this.isValidNum() || this.qnum === -2); + }, + + allowUnshade: function() { + return !(this.isValidNum() || this.qnum === -2); + }, + maxnum: function() { var max = this.board.cell.length - 1; return max <= 999 ? max : 999; @@ -113,13 +150,6 @@ for (var i = 0; i < list.length; i++) { var area = list[i][0].sblk; if (area !== null) { - for (var j = 0; j < area.clist.length; j++) { - for (var k = 0; k < area.clist[j].getdir4clist().length; k++) { - if (!area.clist[j].getdir4clist()[k][0].isShadeDecided()) { - return false; - } - } - } for (var j = 0; j < arealist.length; j++) { if (arealist[j] === area) { area = null; @@ -133,37 +163,32 @@ } } return this.qnum === cnt; - } - }, - "Cell@mines": { - maxnum: 8, + }, - checkComplete: function() { + checkUnambiguous: function() { if (!this.isValidNum()) { return true; } - - var cnt = 0; - var cells = [ - this.relcell(-2, -2), - this.relcell(0, -2), - this.relcell(2, -2), - this.relcell(-2, 0), - this.relcell(2, 0), - this.relcell(-2, 2), - this.relcell(0, 2), - this.relcell(2, 2) - ]; - for (var i = 0; i < 8; i++) { - if ( - cells[i].group === "cell" && - !cells[i].isnull && - cells[i].isShade() - ) { - cnt++; + var cellsAndAdjacent = new Set(); + var list = this.getdir4clist(); + for (var i = 0; i < list.length; i++) { + var area = list[i][0].sblk; + if (area !== null) { + for (var j = 0; j < area.clist.length; j++) { + var sublist = area.clist[j].getdir4clist(); + for (var k = 0; k < sublist.length; k++) { + cellsAndAdjacent.add(sublist[k][0]); + } + } } } - return this.qnum === cnt; + var satisfied = true; + cellsAndAdjacent.forEach(function(cell) { + if (!cell.isShadeDecided()) { + satisfied = false; + } + }); + return satisfied; } }, diff --git a/src/variety/tasquare.js b/src/variety/tasquare.js index 8ec60cc48..3d227f18b 100644 --- a/src/variety/tasquare.js +++ b/src/variety/tasquare.js @@ -62,7 +62,7 @@ if (!this.puzzle.execConfig("autocmp")) { return false; } - return this.checkComplete(); + return this.checkComplete() && this.checkUnambiguous(); }, allowShade: function() { @@ -83,13 +83,6 @@ for (var i = 0; i < list.length; i++) { var block = list[i][0].sblk; if (block !== null) { - for (var j = 0; j < block.clist.length; j++) { - for (var k = 0; k < block.clist[j].getdir4clist().length; k++) { - if (!block.clist[j].getdir4clist()[k][0].isShadeDecided()) { - return false; - } - } - } var shape = block.clist.getRectSize(); if ( shape.cnt !== shape.cols * shape.rows || @@ -102,6 +95,32 @@ } return this.isValidNum() ? this.qnum === cnt : cnt > 0; + }, + + checkUnambiguous: function() { + if (!this.isValidNum()) { + return true; + } + var cellsAndAdjacent = new Set(); + var list = this.getdir4clist(); + for (var i = 0; i < list.length; i++) { + var area = list[i][0].sblk; + if (area !== null) { + for (var j = 0; j < area.clist.length; j++) { + var sublist = area.clist[j].getdir4clist(); + for (var k = 0; k < sublist.length; k++) { + cellsAndAdjacent.add(sublist[k][0]); + } + } + } + } + var satisfied = true; + cellsAndAdjacent.forEach(function(cell) { + if (!cell.isShadeDecided()) { + satisfied = false; + } + }); + return satisfied; } },