Solver"Wave function collapse" is a heuristic we can use to find empty spots to fill. The best empty spot is the one with the fewest possible values. Selecting this space will split the search space the most evenly. Back tracking will then search the potential space faster. Inherently it will not select new values that are invalid.
|
Solvable: Yes Unique: |
Grid GeneratorStart with an empty board and use the solver until it is valid. The grid is valid if there are no duplicate values in any row, column, or 3x3 square. We backtrack if we reach a point where we cannot place a value without violating the rules.
|
Solvable: Yes Unique: |
Puzzle GeneratorTo generate a sudoku, we can start with a solved grid and remove values. If we cannot delete a value without making the board non-unique, we have reached the maximum difficulty.
|
Solvable: Yes Unique: |
Difficulty GraderThe difficulty of the puzzle can likely be determined as a function of steps, backtracks and branches. The obvious metric is to use the number of steps, but the number of backtracks and branches may also be useful. For now the number of steps will be used, but the other metrics will be stored for future use. Top 5 of 2 found puzzles
Bottom 5 of 2 found puzzles
|
Solvable: No Unique: |
After the solver has found a solution, we backtrack if the branch stack has remaining items and continue solving. We keep track of how many times we have found a solution and if we find a solution more than once, the board is not unique. The current implementation short-circuits on finding the second solution. The algorithm is behind a calculate button because it is computationally expensive to calculate each time we update the board.
When we don't have a sigma, we use the first observation as the sigma. When we observe a new value, we calculate the variance between the observation and our expected mean. We treat sigma as all observed variances then take the square root of the sum of the squares of the variances. We observe 4 historical points with 1 new observation. Lastly, we divide by 5 to get the average difference. It is important to note that black swan observations whilst smoothed, can cause the sigma to be very large immediately after the observation.
NOTE: Currently using local storage. Switching your browser switches the cache. I am considering using an online service to maintain a cache.
0 | grids | (2 | bytes) |
2 | puzzles | (329 | bytes) |