The generation of levels now works. It will take a lot of testing to see if it's good enough.

Levels are now created like this (pseudo):
while (!level.IsSolved)
{
var move = Solver.GetMove(level);
if (move == null)
{
if (!GenerateRandomHintGroup())
{
// If a hint group cannot be generated, then the level cannot be generated.
return null;
}
}
else
{
ApplyMove(level, move);
}
}
return level;The solver
The solver currently has these "techniques" of finding moves:
- AggregateEliminationSolver: Calculates every number combination that will create the sum/product/difference/etc. and eliminate any numbers that are not used in any of the solutions.
- NumberEliminatedEverywhereElseSolver: A number has been eliminated in every other square in its column/row and is therefore the answer.
- NumberLocationNarrowedSolver An example of this is when a row contains these squares (solution outside and non-eliminated numbers in brackets):
- 1 [1, 4]
- 2 [2, 4, 5]
- 3 [2, 3, 4]
- 4 [1, 4]
- 5 [1, 2, 5]
- OnlyOneNumberNotEliminatedSolver: Every number but one has been eliminated in a cell.
- EqualsSolver: Answers with the number indicated by an equals hint group.
0 comments:
Post a Comment