-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
483 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<body> | ||
<h2>Solution Path</h2> | ||
{0} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Project: Sudoku Explainer | ||
* Copyright (C) 2023 1to9only | ||
* Available under the terms of the Lesser General Public License (LGPL) | ||
*/ | ||
package diuf.sudoku.solver; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Hints accumulator, that accumulates hints of the same rating. | ||
*/ | ||
public class SmallestHintAccumulator implements HintsAccumulator { | ||
|
||
private List<Hint> result = new ArrayList<Hint>(); | ||
|
||
private double lastDifficulty = 0.0; | ||
|
||
public SmallestHintAccumulator() { | ||
super(); | ||
} | ||
|
||
public void add( Hint hint) throws InterruptedException { | ||
double newDifficulty = ((Rule)hint).getDifficulty(); | ||
if ( lastDifficulty == 0.0 ) { | ||
lastDifficulty = newDifficulty; | ||
} | ||
if ( lastDifficulty != newDifficulty ) { | ||
throw new InterruptedException(); | ||
} | ||
if ( !result.contains( hint) ) { | ||
result.add( hint); | ||
} | ||
} | ||
|
||
public List<Hint> getHints() { | ||
return result; | ||
} | ||
|
||
public boolean hasHints() | ||
{ | ||
return !result.isEmpty(); | ||
} | ||
|
||
public void clear() | ||
{ | ||
result.clear(); | ||
lastDifficulty = 0.0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.