Sudoku - A sudoku solver
This program implements scanning and blocked rows or columns invalidation.
It does not consider all effects of multiple number blocking,
where a combination of invalid numbers blocks a row or column.
In such cases a simple backtracking algorithm continues to solve the sudoku.
parrot -Ot sudoku.pir [--options] [file]
If no file is given a builtin game is run.
Valid options are:
- Print version information and exit.
- Print help hint and exit.
- Print debug output and game progress to stdout.
- Print additionally invalid state of given number(s).
- Run builtin game. If no name is given a list of builtins is printed.
- Use ncurses for display and single step through progress. Press any key for next display.
The game state is held in multiple views which share one Integer PMC per common position. Thus updating a row sets also the column or square information. These three views are list of lists.
Game files may contain comments (hash sign in the first column) digits, and dots for empty fields. E.g:
# der standard 020 - leicht
- Parrot OO
- The solver is an object as well as the display.
- For deep copying the game state for backtracking.
- Multi Method Dispatch
- The display classes define multiple methods with the name print, which take different types and amounts of arguments.
- The program uses Getopt/Long and the ncurses library.
- Exception handling
- To turn off ncurses just in case.
- rows, cols, sqrs
- LoL of 0 = free, 1..9 = number
- i_rows, i_cols, i_sqrs
- LoL of a bitmask of invalid numbers per field. Bits are starting at bit one not zero.
- Hash referencing these 6 items - used for backtracking.
- The option hash.
- Holds an instance of the display class (Dummy, NCurses) to use.
Same as parrot.