diff --git a/diuf/sudoku/Grid.java b/diuf/sudoku/Grid.java index e3d66df..a311047 100644 --- a/diuf/sudoku/Grid.java +++ b/diuf/sudoku/Grid.java @@ -2712,6 +2712,14 @@ public BitSet crossBlade2(int index) { return blockGroupedCellSet; } + //1 Cell set corresponds to intersection cell in block cells that share exactly 1 column and 1 row + public BitSet crossHeart(int index) { + BitSet blockGroupedCellSet = new BitSet(10); + blockGroupedCellSet.set(index); + return blockGroupedCellSet; + } + + //cellIndex of blockCell at centre of Cross Cell set public int Heart(int index) { int[] blocksHeartCells = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; diff --git a/diuf/sudoku/Settings.java b/diuf/sudoku/Settings.java index 76edeb8..8237b2d 100644 --- a/diuf/sudoku/Settings.java +++ b/diuf/sudoku/Settings.java @@ -18,8 +18,8 @@ public class Settings { public final static int VERSION = 1; public final static int REVISION = 18; - public final static String SUBREV = ".0"; - public final static String releaseDate = "2021-09-21"; + public final static String SUBREV = ".1"; + public final static String releaseDate = "2021-09-22"; public final static String releaseYear = "2021"; public final static String releaseLicence = "Lesser General Public License"; public final static String releaseLicenceMini = "LGPL"; diff --git a/diuf/sudoku/solver/rules/StrongLinks.java b/diuf/sudoku/solver/rules/StrongLinks.java index ab9b7cd..4e7748e 100644 --- a/diuf/sudoku/solver/rules/StrongLinks.java +++ b/diuf/sudoku/solver/rules/StrongLinks.java @@ -293,6 +293,9 @@ private void buildLinks(Grid grid, int digit, int[] linkSet, int linksNumber, in continue; BitSet baseLinkBlade1 = (BitSet)baseLinkRegionPotentials.clone(); BitSet baseLinkBlade2 = (BitSet)baseLinkRegionPotentials.clone(); + //@SudokuMonster #111 bug fixattempt + BitSet beatingHeart = (BitSet)baseLinkRegionPotentials.clone(); + if (baseLinkRegionPotentialsC > 2) { //Grouped Strong links in box have 15 configurations but only 9 are ER for (e[linksDepth] = 0; e[linksDepth] < (linkSet[linksDepth] < 1 ? 15 : 3); e[linksDepth]++) { @@ -304,6 +307,8 @@ private void buildLinks(Grid grid, int digit, int[] linkSet, int linksNumber, in BitSet baseLinkEmptyArea = (BitSet)baseLinkRegionPotentials.clone(); baseLinkBlade1 = (BitSet)baseLinkRegionPotentials.clone(); baseLinkBlade2 = (BitSet)baseLinkRegionPotentials.clone(); + //@SudokuMonster #111 bug fixattempt + beatingHeart = (BitSet)baseLinkRegionPotentials.clone(); if (linkSet[linksDepth] == 0 || linkSet[linksDepth] == 3 || linkSet[linksDepth] == 4) { //confirm if we have an empty rectangle //block has 9 cells: 4 "Cross" cells, 4 "Rectangle" cells and 1 "Heart" cell @@ -320,6 +325,8 @@ private void buildLinks(Grid grid, int digit, int[] linkSet, int linksNumber, in //9 configurations for each block depending on "Heart" cell baseLinkBlade1.and(baseLinkRegion[linksDepth].crossBlade1(e[linksDepth])); baseLinkBlade2.and(baseLinkRegion[linksDepth].crossBlade2(e[linksDepth])); + //@SudokuMonster #111 bug fixattempt + beatingHeart.and(baseLinkRegion[linksDepth].crossHeart(e[linksDepth])); } else { baseLinkBlade1.and(baseLinkRegion[linksDepth].lineBlade1(e[linksDepth])); @@ -443,8 +450,17 @@ private void buildLinks(Grid grid, int digit, int[] linkSet, int linksNumber, in cells[linksDepth * 2 + 1] = baseLinkRegion[linksDepth].getCell(baseLinkBlade1.nextSetBit(p1 + 1)); cells[linksNumber * 2 + linksDepth * 2 + 0] = baseLinkRegion[linksDepth].getCell(baseLinkBlade2.nextSetBit(0)); } - if (!EmL) - baseLinkGroupedLinkOrdinal = 1; } + if (!EmL) { + baseLinkGroupedLinkOrdinal = 1; + //@SudokuMonster #111 bug fixattempt + if (e[linksDepth] < 9){ + if (baseLinkBlade1.cardinality() == 2 && beatingHeart.cardinality() == 1) + cells[linksDepth * 2 + linksNumber * 4 + 0] = baseLinkRegion[linksDepth].getCell(baseLinkRegion[linksDepth].Heart(e[linksDepth])); + if (baseLinkBlade2.cardinality() == 2 && beatingHeart.cardinality() == 1) + cells[linksDepth * 2 + linksNumber * 4 + 1] = baseLinkRegion[linksDepth].getCell(baseLinkRegion[linksDepth].Heart(e[linksDepth])); + } + } + } } else { baseLinkGroupedLinkOrdinal = 1;