This is a draft pull request for use ONLY as placeholder for comments.
The code is NOT ready for merging.
The improvements done in nestedChains branch compared to master
A new class DigitCells that holds alive pencilmarks ordered by value then by cell.
A new class HintsCache that collects hints found by particular algorithm for particular grid state for reusing.
Two new and currently unused fields in Grid
private Grid initialGrid - a reference to a grid state after last applied eliminations,
private DigitCells dCells - a reference to current grid state in DigitCells form.
Cancellation of experimental nesting techniques beyond those used for hardest vanilla puzzles.
Cancellation of code enclosed in if (Settings.getInstance().Fixed14Chaining() == 1).
Modifications in Solver.getBatchDifficulty required for handling the global HintsCache.
Modifications in Chaining including
use of locally built instance of DigitCells for search acceleration,
use of HintsCache resulting in almost doubling the speed,
removal of fields saveGrid, lastGrid, lastHints after replacing functionalities related to them by better ones,
introduction of new field signature required by HintsCache,
optimization of some critical loops.
The changes that are not done but are required before merging
All instances of solving loop must care about global HintsCache reset between puzzles and purge between applying hint eliminations. Reason for not implementing this is the variety of loops that recently appeared and are difficult to track.
All manual interventions to grid state from GUI must handle (or simply reset) the global HintsCache.
Possible further improvements based on the changes
Using Grid.initialGrid within hints collection algorithm for comparison between initial grid state and eventually locally modified one. Removal of local clones of the grid where possible, or at least reduce cloning to making a local copy instead of making and then restoring a backup.
Using Grid.dCells, after single earlier initialization, in all solving techniques that benefit of it.
Using HintsCache by more techniques after implementing a signature for the respective technique.
This is a draft pull request for use ONLY as placeholder for comments. The code is NOT ready for merging.
The improvements done in nestedChains branch compared to master
class DigitCells
that holds alive pencilmarks ordered by value then by cell.class HintsCache
that collects hints found by particular algorithm for particular grid state for reusing.private Grid initialGrid
- a reference to a grid state after last applied eliminations,private DigitCells dCells
- a reference to current grid state inDigitCells
form.if (Settings.getInstance().Fixed14Chaining() == 1)
.Solver.getBatchDifficulty
required for handling the globalHintsCache
.Chaining
includingDigitCells
for search acceleration,HintsCache
resulting in almost doubling the speed,saveGrid
,lastGrid
,lastHints
after replacing functionalities related to them by better ones,signature
required byHintsCache
,The changes that are not done but are required before merging
HintsCache
reset between puzzles and purge between applying hint eliminations. Reason for not implementing this is the variety of loops that recently appeared and are difficult to track.HintsCache
.Possible further improvements based on the changes
Grid.initialGrid
within hints collection algorithm for comparison between initial grid state and eventually locally modified one. Removal of local clones of the grid where possible, or at least reduce cloning to making a local copy instead of making and then restoring a backup.Grid.dCells
, after single earlier initialization, in all solving techniques that benefit of it.HintsCache
by more techniques after implementing asignature
for the respective technique.