-
Notifications
You must be signed in to change notification settings - Fork 0
Herbdoku instance & methods
HvdW144 edited this page Jun 25, 2024
·
1 revision
The Herbdoku instance is the heart of this repository (duh). It is programmed in such a way that you can chain all the methods you need, with a build()
at the end to get the final result. User Experience is the core of the story. It is focused on being as easy to use as possible. Hence, this wiki.
Purpose:
Initialize the herbdoku instance with a sudokuString
to validate and a gridSize
.
Syntax:
const herbdoku = new Herbdoku("1234341221434321", 4);
Parameters:
-
sudokuString: string
A zero-based string representation of the sudoku grid, counting in row-major order (This means a sudoku with grid size 9 will have the indexes from 0 to 80). -
gridSize: number = 9
The size of the sudoku grid (assuming sudoku grids are square). Defaults to 9.
Related types:
None
Example:
const herbdoku = new Herbdoku("452891763391627854687435912716582439529314687834976521148753296973268145265149378");
const result = herbdoku.validateDefault().build();
console.log(result);
Purpose:
Call this method to finalize the validation, it will return a ValidationResult instead of the herbdoku instance.
Syntax:
herbdoku.build();
Parameters:
None
Related types:
Example:
const herbdoku = new Herbdoku("1234341221434321", 4);
const result = herbdoku.validateDefault().build();
console.log(result);