https://github.com/8dcc/sudoku
Simple sudoku game (and CLI solver) for the terminal using ncurses and written in C
https://github.com/8dcc/sudoku
c cli ncurses sudoku sudoku-generator sudoku-solver
Last synced: 13 days ago
JSON representation
Simple sudoku game (and CLI solver) for the terminal using ncurses and written in C
- Host: GitHub
- URL: https://github.com/8dcc/sudoku
- Owner: 8dcc
- License: gpl-3.0
- Created: 2022-11-25T12:31:38.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-30T11:45:03.000Z (6 months ago)
- Last Synced: 2026-01-03T02:27:51.138Z (6 months ago)
- Topics: c, cli, ncurses, sudoku, sudoku-generator, sudoku-solver
- Language: C
- Homepage:
- Size: 82 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sudoku
**Simple sudoku for the terminal using ncurses and written in C.**


### Building
Simply run:
```bash
git clone https://github.com/8dcc/sudoku
cd sudoku
# For the game itself
make sudoku.out
# From a simple text solver
make solver.out
# Or both at once
make
```
If you don't want the **game** to show colors (for ncurses) simply comment this line in [`src/game/globals.h`](https://github.com/8dcc/sudoku/blob/dabfb31086e15f60f837844885fabe533d98c2aa/src/game/globals.h#L5-L8).
If you don't want the **solver** program to show colors (for example for some windows terminals or for redirecting the output) simply comment this line in [`src/solver/defines.h`](https://github.com/8dcc/sudoku/blob/dabfb31086e15f60f837844885fabe533d98c2aa/src/solver/defines.h#L2-L7).
```c
/*
* Comment this line if you don't want colors!
* Will not print with colors if not defined, useful for redirecting the output of
* the command.
*/
#define USE_COLOR
```
### Playing the game
Simply run:
```console
$ ./sudoku.out --help
Usage:
./sudoku.out - Run with default difficulty.
./sudoku.out - Where number is the number of cells that are going to be filled. [1-80]
```
### Using the solver
The solver program will try to read from the filename specified as argument, or stdin if none. The program checks if stdin is a piped file or command output (only on linux) and prints the usage if not.
```console
$ ./solver.out filename.txt
...
$ ./solver.out < filename.txt
...
$ cat filename.txt | ./solver.out
...
$ ./solver.out # Will only check for pipes on linux
Usage:
./solver.out file.txt
./solver.out < file.txt
```