Caution
Please clean all function files before committing.
Warning
Make sure to pull the latest file to edit.
- Ching Chun Wing (3035928823)
- Kim Minjae ( )
- Nie Hong ( )
- Wong Lik Wai (3036222721)
Sudoku is a logic-based, combinatorial number-placement puzzle. In Sudoku, the objective is to fill a 9 × 9 grid with digits so that each column, each row, and each of the nine 3 × 3 subgrids contains all of the digits from 1 to 9.
In our game, you will randomly be given a game puzzle when you start. The level of difficulty will also vary with the choice of puzzle. The only way to win is to fill in all grids with 1 to 9 with the Sudoku rules.
To fulfil the project requirement, our code has the following features:
- Generation of random game sets or events
Our game puzzle is randomly generated from files 1-10.txt every time
srand(time(0));
int k = rand()%10+1; - Data structures for storing game status (e.g., arrays, STL containers)
We have used a 2-D int array to store our Sudoku puzzle
int sudoku[9][9] = {0}
- Dynamic memory management (e.g., dynamic arrays, linked lists, STL containers)
We have used dynamic STL containers for storing our preset coordinate
vector presetv;
if (count(presetv.begin(), presetv.end(), coordinate) > 0){ ... } - File input/output (e.g., for loading/saving game status)
We have used file 1-10.txt for inputting our game puzzle
ifstream fin;
char filename[6] = {char(k+48),'.','t','x','t'};
while (fin >> coordinate >> value){ ... } - Program codes in multiple files (recall separate compilation)
We havecheck
(Compile fromcheck.h
&check.cpp
) andprint
(Compile fromprint.h
&print.cpp
) for separate compilation
#include "print.h"
#include "check.h" - Proper indentation and naming styles
We followed correct indentation and programming style for C++ - In-code documentation
We inserted comments and README for documentation
To start the game, please make use of Makefile:
make main
./main
Enter a coordinate and its value (Note: you cannot change our preset value!)
For example: Editing A3 be 6; Press ENTER and you will see the result:
1 2 3 4 5 6 7 8 9 + + + + + + + + + + + + + A + 0 0 0 + 0 0 0 + 9 2 0 + A B + 5 4 0 + 0 3 0 + 1 0 0 + B C + 0 0 8 + 0 5 7 + 0 0 4 + C + + + + + + + + + + + + + D + 0 5 0 + 0 8 0 + 0 0 3 + D E + 9 0 3 + 0 4 6 + 8 0 0 + E F + 1 0 0 + 3 0 0 + 0 4 0 + F + + + + + + + + + + + + + G + 0 7 0 + 4 0 0 + 0 0 0 + G H + 3 6 1 + 0 7 9 + 0 8 0 + H I + 0 0 0 + 0 6 0 + 0 3 7 + I + + + + + + + + + + + + + 1 2 3 4 5 6 7 8 9 Please enter the coordinate and its value: A3 6 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + + + A + 0 0 6 + 0 0 0 + 9 2 0 + A B + 5 4 0 + 0 3 0 + 1 0 0 + B C + 0 0 8 + 0 5 7 + 0 0 4 + C + + + + + + + + + + + + + D + 0 5 0 + 0 8 0 + 0 0 3 + D E + 9 0 3 + 0 4 6 + 8 0 0 + E F + 1 0 0 + 3 0 0 + 0 4 0 + F + + + + + + + + + + + + + G + 0 7 0 + 4 0 0 + 0 0 0 + G H + 3 6 1 + 0 7 9 + 0 8 0 + H I + 0 0 0 + 0 6 0 + 0 3 7 + I + + + + + + + + + + + + + 1 2 3 4 5 6 7 8 9 Please enter the coordinate and its value: C8 5 ...
To quit the game during any time after the game started, please type q:
... Please enter the coordinate and its value: q BYE!!
You will receive the following command if you win the game:
You are WIN~ BYE!!
You are recommended to clean the repo after you enjoy our game, use clean function in our Makefile:
make clean
- Ching Chun Wing (3035928823)
Responsible for
checkwin()
function in check.cpp, the trailer, and creating files for puzzle input. - Kim Minjae ( )
Please declare your own contribution here...
- Nie Hong ( )
Please declare your own contribution here...
- Wong Lik Wai (3036222721)
Responsible for main function code in main.cpp,
printv()
function in print.cpp and editing this README.MD file.