Commit Briefs

96595c487f Rene Kita

Add pretty print command (master)

Thanks to Tommy Andersen <andersentommy@gmail.com> for the idea! See https://github.com/Barium/killer-sudoku-solver.git


d6df72905a Rene Kita

Only collect filenames with 4 digits when testing


47be84918e Rene Kita

Be a little bit more verbose when tests fail


b50f742b10 Rene Kita

Do not over-allocate

Looks like a left-over from a malloc call.


4abde331d9 Rene Kita

Add man pages


6183882b0b Rene Kita

Update README

* Be more precise when describing the input format * Fix a typo * Add link to blog post


d1b50eb303 Rene Kita

Run the linter at the end of the CI build (tags/v0.1)


04017675e6 Rene Kita

Make scan-build executable configurable


75ecc4f5bc Rene Kita

Consume all input after detecting an syntax error


acf1f89d9d Rene Kita

Increment pointer before NUL check

No functional change. Saves one iteration and expresses the intend more clearly.


Branches

Tags

Tree

.builds/
.gitignorecommits | blame
COPYINGcommits | blame
INSTALLcommits | blame
Makefilecommits | blame
READMEcommits | blame
combos.hcommits | blame
example/
ksudbf.6commits | blame
ksudbf.ccommits | blame
ksudhints.6commits | blame
ksudhints.ccommits | blame
t/
uncrustify.cfgcommits | blame

README

ksudbf
======

A solver for killer sudokus using brute force.

ksudbf stands for killer sudoku brute forcer.  It was intentionally abbreviated
to six awkward letters.

ksudbf will try to solve a given killer sudoku using recursive backtracking.
It prints either a solution to stdout or exits with an error.


Usage
-----
ksudbf [FILE]

With no FILE, or when FILE is -, read standard input.


Input format
------------

The input file has the following format:
cage sum <space> coordinate <space> ... <newline>

Example:
A 'L'-shaped cage with hint/value 6 and 3 cells in the top left corner:
6 11 12 21

See example/ for a complete example including the solution.

The following table shows all coordinates:
|----------+----------+----------|
| 11 12 13 | 14 15 16 | 17 18 19 |
| 21 22 23 | 24 25 26 | 27 28 29 |
| 31 32 33 | 34 35 36 | 37 38 39 |
|----------+----------+----------|
| 41 42 43 | 44 45 46 | 47 48 49 |
| 51 52 53 | 54 55 56 | 57 58 59 |
| 61 62 63 | 64 65 66 | 67 68 69 |
|----------+----------+----------|
| 71 72 73 | 74 75 76 | 77 78 79 |
| 81 82 83 | 84 85 86 | 87 88 89 |
| 91 92 93 | 94 95 96 | 97 98 99 |
|----------+----------+----------|


Hints
=====

ksudhints lets you show the solution step by step. You can reveal specific
cells or get a hint for an unspecified cell. Cages with fewer cells are
revealed earlier, starting in the top left corner. It also let's you fill in
already solved cells while ignoring wrong input.


Usage
-----

ksudhints -s FILE -p FILE

-s	a solution as given by ksudbf
-p	the input file for the solution (same format as ksudbf)

With most recent shells one can use:
$ ksudhints -p FILE -s <(ksudbf <FILE)

Commands:
XY [r]     - Reveal cell XY.
[XY] r [N] - Reveal 1 or N random cells starting with cell XY.
XY t N     - Test if cell XY has value N
n [N]      - Show 1 or N next hints.
p          - Print the board.
P          - Pretty print the board.
s          - Show a table with all coordinates.
e          - Open the board in $EDITOR (to add values to the partial solution).
h          - Show this help text.

Press <Enter> without command to repeat the previous one.

Press ^D to see the complete solution and exit.


See my blog post[0] for a little tutorial.

[0]: https://rkta.de/ksudbf.html


Installation
============

See INSTALL