Skip to content

Commit

Permalink
Bug fixes, Comments and clear warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SudokuMonster committed Dec 21, 2019
1 parent 7b5315c commit 7e0b433
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
18 changes: 9 additions & 9 deletions diuf/sudoku/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class Settings {

public final static int VERSION = 1;
public final static int REVISION = 14;
public final static String SUBREV = ".8";
public final static String releaseDate = "2019-12-18";
public final static String SUBREV = ".11";
public final static String releaseDate = "2019-12-21";
public final static String releaseYear = "2019";
public final static String releaseLicence = "Lesser General Public License";
public final static String releaseLicenceMini = "LGPL";
Expand Down Expand Up @@ -298,7 +298,7 @@ public void toggleVariants() {

public void setBlocks(boolean isBlocks) {
this.isBlocks = isBlocks;
toggleVariants();
toggleVariants();;
save();
}

Expand All @@ -308,7 +308,7 @@ public boolean isBlocks() {

public void setDG(boolean value) {
this.isDG = value;
toggleVariants();
toggleVariants();;
save();
}

Expand All @@ -318,7 +318,7 @@ public boolean isDG() {

public void setX(boolean value) {
this.isX = value;
toggleVariants();
toggleVariants();;
save();
}

Expand All @@ -328,7 +328,7 @@ public boolean isX() {

public void setWindows(boolean value) {
this.isWindows = value;
toggleVariants();
toggleVariants();;
save();
}

Expand All @@ -338,7 +338,7 @@ public boolean isWindows() {

public void setGirandola(boolean value) {
this.isGirandola = value;
toggleVariants();
toggleVariants();;
save();
}

Expand All @@ -348,7 +348,7 @@ public boolean isGirandola() {

public void setCD(boolean value) {
this.isCD = value;
toggleVariants();
toggleVariants();;
save();
}

Expand All @@ -358,7 +358,7 @@ public boolean isCD() {

public void setAsterisk(boolean value) {
this.isAsterisk = value;
toggleVariants();
toggleVariants();;
save();
}

Expand Down
1 change: 1 addition & 0 deletions diuf/sudoku/gui/SudokuFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public void setCurrentHint(Grid grid, Hint hint, boolean isApplyEnabled) {
} else {
getHintDetailArea().setText(null);
getSudokuPanel().setBlueRegions();
//SudokuMonster: setHighlightedCells is an alternative to yellow cell backgrounds getSelectedCells()
getSudokuPanel().setHighlightedCells(null);
getSudokuPanel().setLinks(null);
viewCount = 1;
Expand Down
3 changes: 2 additions & 1 deletion diuf/sudoku/gui/SudokuPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class SudokuPanel extends JPanel {
private Collection<Cell> greenCells;
private Collection<Cell> redCells;
private Grid.Region[] blueRegions;
//SudokuMonster: Modification to yellow background cells getSelectedCells()
private Cell[] highlightedCells;
private Collection<Link> links;

Expand Down Expand Up @@ -337,7 +338,7 @@ public void setBluePotentials(Map<Cell, BitSet> bluePotentials) {
public void setBlueRegions(Grid.Region... regions) {
this.blueRegions = regions;
}

//SudokuMonster: Modification to yellow background cells getSelectedCells()
public void setHighlightedCells(Cell[] cells) {
this.highlightedCells = cells;
}
Expand Down
5 changes: 3 additions & 2 deletions diuf/sudoku/solver/rules/NakedSetGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ private IndirectHint createValueUniquenessGenHint(Grid grid, Grid.Region region,
}
// Build removable potentials
Map<Cell,BitSet> removablePotentials = new HashMap<Cell,BitSet>();
int eliminationsTotal = 0;
//SudokuMonster: eliminationsTotal can be enabled to sort hints
//int eliminationsTotal = 0;
for(int i = commonPotentialValues.nextSetBit(0); i >= 0; i = commonPotentialValues.nextSetBit(i + 1)) {
CellSet Victims = null;
for (Cell cell : cells)
Expand All @@ -118,7 +119,7 @@ private IndirectHint createValueUniquenessGenHint(Grid grid, Grid.Region region,
Victims.retainAll(cell.getVisibleCells());
for (Cell cell : Victims)
if (grid.hasCellPotentialValue(cell.getIndex(), i)) {
eliminationsTotal++;
//eliminationsTotal++;
if (removablePotentials.containsKey(cell))
removablePotentials.get(cell).set(i);
else
Expand Down
12 changes: 7 additions & 5 deletions diuf/sudoku/test/serate.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private static String isItExperimental() {
* 1 for use
*/
private static boolean setTechniques(String techniques, boolean showArguments) {
EnumSet<SolvingTechnique> allTechniques = EnumSet.allOf(SolvingTechnique.class);
EnumSet<SolvingTechnique> allTechniques = EnumSet.allOf(SolvingTechnique.class);
try {
EnumSet<SolvingTechnique> useTechniques = EnumSet.noneOf(SolvingTechnique.class);
Iterator<SolvingTechnique> iter = allTechniques.iterator();
Expand Down Expand Up @@ -314,7 +314,8 @@ public static void main(String[] args) {
boolean isX = false; //X (Main diagonal and Anti diagonal groups) are by default disabled.
boolean isGirandola = false; //Girandola is by default disabled.
boolean isAsterisk = false; //Asterisk is by default disabled.
boolean isCD = false; //Center Dot is by default disabled.
boolean isCD = false; //Center Dot is by default disabled.
boolean isTechs = false; //This checks if --techs has been used.
char want = 0;
int arg;
//long t; //not used anymore
Expand Down Expand Up @@ -560,7 +561,7 @@ else if (++arg < args.length) {
break;
//@SudokuMonster: (lkSudoku)
case '~':
setTechniques(v, showArguments);
isTechs = setTechniques(v, showArguments);
break;
default:
usage(a, 0);
Expand Down Expand Up @@ -599,8 +600,9 @@ else if (++arg < args.length) {
writer = new PrintWriter(writer1);
}
formatter = new Formatter(writer, formatStart, formatAfter, formatBefore, format);
//@SudokuMonster: The following is to target the static visibleCells in case there are variants
Grid.changeVisibleCells();
//@SudokuMonster: The following is to default to the default set of techniques even if variants
if (!isTechs)
Settings.getInstance().Settings_Variants();
//loop over input puzzles
for (;;) {
if (reader != null) {
Expand Down

0 comments on commit 7e0b433

Please sign in to comment.