C-Doku is a C implementation of Sudoku in your very own terminal! The game prints a minimalist visualization of an incomplete board for a player to solve based on the level they chose, and the user can specify a number to input into a specific row and column. The visualization will continue updating based on the user input. The player wins if they complete the board before getting 3 errors!
We used these board puzzles to create our game.
The player starts with a partially filled 9x9 board of digit 1-9 to fill in. The player needs to fill each cell with a digit ranging from 1-9 with the following rules:
- Every row must have one of each digit (1-9).
- Every column must have one of each digit (1-9).
- Every 3x3 square within the 9x9 must have one of each digit (1-9).
- Choose difficulty: Player chooses a level (easy, medium hard).
- Visualize board: Game displays an incomplete board for the player to complete.
- Input move: Player inputs a row, column, and number to add to the board.
- Move correct -> board updates accordingly
- Move incorrect -> board does not update & error counter increases by 1
- Move not valid -> no changes made & player will be prompted to input their move correctly.
- Keep trying: The program prompts the player to keep filling the board until an end condition is met.
- Win or lose: The game ends when an end condition is met.
- Win -> board is completely filled with less than 3 errors
- Lose -> player makes 3 errors before board is completely filled
To play the game, download all the files from our C-Doku repository. You can also download it directly here. You should have the following files:
- src
- CMakeLists.txt
- controller.c
- controller.h
- main.c
- model.c
- model.h
- view.c
- view.h
- test
- CMakeLists.txt
- test_controller.c
- test_model.c
- test_view.c
- .gitignore
- CMakeLists.txt
- README.md
This code only relies on C standard libraries, which means that you won't need to worry about importing any additional libraries.
To get started, please ensure that you are using a Unix environment to follow the instructions below.
Once you have downloaded the files from the repository, navigate to the C-Doku directory. From there, you can create a build directory and compile the program by running the following commands in your terminal:
$ mkdir build
$ cd build
$ cmake ..
$ make clean
$ make
Then run the following command to start the game:
$ ./src/run_sudoku
Have fun playing the game!