Sudoku Game
Sudoku Game
INTRODUCTION
1. Sudoku is a puzzle that has enjoyed worldwide popularity since 2005. To solve
a Sudoku puzzle, one needs to use a combination of logic and trial-and-error.
2. More math is involved behind the scenes: combinations used in counting valid
sudoku grids, group theory(well-known algebraic structures, such as rings,
fields, and vector spaces) used to describe ideas of when two grids are
equivalent, and computational complexity with regards to solving Sudokus.
3. Sudoku is a logic-based, combinatorial, number-placement puzzle. The
objective is to fill a 9-by-9 grid with digits so that each column, each row, and
each of the nine 3-by-3 sub-grids that compose the grid also called "boxes",
"blocks", "regions", or "sub-squares" contains all of the digits from 1 to 9. The
puzzle setter provides a partially completed grid, which for a well-posed
puzzle has a unique solution.
SUDOKU GRID
TOOLS
Platform: Code Blocks/VS Code
Language: C++
ALGORITHM
1. We have declared 18 void functions and 1 char function for various activities in Sudoku
Game. In main function, we have added main menu of start, instruction and exit.
2. Using gotoMenu () function, we are taking user input using switch case and getch().
4. We also have use getch() function to get user input. We have created
showHardProgressMode() function for hard level where progress is not shown in
percentage or in number.
ALGORITHM
1) Most important function is mainGame() where all building of table is created. We have define
pointer which display position and various colors have been added for different pages. Function
of keyboard keys also define in mainGame() function.
2) Then, we have defined function for arrow keys, delete ,backspace key. Then we have given
condition in setNumberKey() function that the number will be added only when the box is
empty.
4) Lastly, we create function as hideCursor(), which hides cursor in the console screen and to
function keyboard keys smoothly.
RESULTS
RESULTS
RESULTS
RESULTS
RESULTS
CONCLUSION
We have created console based sudoku game. We have added 3 modes which are Easy, Medium
and Hard.
We have used keyboard functions to play the game. We also get solution at the end.
https://docs.microsoft.com/en-us/windows/console/setconsoletextattribute
https://www.daniweb.com/programming/software-development/threads/368006/getch-and
-arrow-keys
http://www.qb64.org/wiki/Keyboard_scancodes
https://pdf.co/blog/sudoku-game-in-c
https://en.wikipedia.org/wiki/Sudoku
https://sudoku.com/