$ cd .. — all projects
monogram-resolver
A nonogram solver that does not guess. The board goes through a pipeline of small rules, each of which can be read and tested on its own.
TypeScript · Vitest · canvas · 2024
# how it works
01 · detector/Board analysis
The detector reads rows, columns and their groups.
02 · model/Model
Cells and groups become objects the rules work on.
03 · resolver/Rule pipeline
Every resolver returns cells to fill in and cells to exclude.
# one rule, one file
Instead of one big algorithm there is a set of small classes. Each one extends a shared model and implements a single method.
resolver/legacy/basic/resolver-value-overlap.ts
export class ValueOverlapResolver extends ResolverModel {
run(group: GroupModel, groupCells: CellModel[]): ResolverResult {
const result = ResolverResult.create(groupCells);
result.addIndexResult(
this.resolveGroup(group.values, groupCells),
groupCells,
);
return result;
}
}
- basic
- done
- double
- extend
- hole
- separated
- first-and-biggest
# tests
Next to every rule sits its *.spec.ts file. A rule starts from a test: first an example row, then the code that solves it.