Skip to content
/ sudoku Public

Simple sudoku game (and CLI solver) for the terminal using ncurses and written in C

License

Notifications You must be signed in to change notification settings

8dcc/sudoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoku

Simple sudoku for the terminal using ncurses and written in C.

ss1 ss2

Building

Simply run:

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.

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.

/*
 * 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:

$ ./sudoku.out --help
Usage:
    ./sudoku.out            - Run with default difficulty.
    ./sudoku.out <number>   - 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.

$ ./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