Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.99 KB

README.md

File metadata and controls

60 lines (41 loc) · 1.99 KB

SUDOKU SOLVER

It's a simple program for solving sudoku of any difficulty level.
It uses the basics of recursion to solve the sudoku.

Prerequisite

Make sure to install the latest version of mingw to run this program.

Get the program running

Input the sudoku

Inorder to input other sudoku,
Firstly, open the .cpp file in any text editor or IDE of your preference.

    vector<vector<char>> sudoku = {
        {'5', '3', '.', '.', '7', '.', '.', '.', '.'}, 
        {'6', '.', '.', '1', '9', '5', '.', '.', '.'},
        {'.', '9', '8', '.', '.', '.', '.', '6', '.'},
        {'8', '.', '.', '.', '6', '.', '.', '.', '3'},
        {'4', '.', '.', '8', '.', '3', '.', '.', '1'},
        {'7', '.', '.', '.', '2', '.', '.', '.', '6'},
        {'.', '6', '.', '.', '.', '.', '2', '8', '.'},
        {'.', '.', '.', '.', '1', '9', '.', '.', '5'},
        {'.', '.', '.', '.', '8', '.', '.', '7', '9'}
    };  

//Here '.' suggests the blank spaces in the sudoku

Now, you can edit this part of the code according to a question of your choice and make sure that all numbers are enclosed within single quotes

Commands to run

Windows

g++ sudoku_solver.cpp -o filename   //this line compiles the program and makes sure it's error free
filename                            //file name suggests the name of the file you want to store the program as

Linux

g++ sudoku_solver.cpp -o filename   //this line compiles the program and makes sure it's error free
./filename                            //file name suggests the name of the file you want to store the program as

Output

The output of the above input of sudoku is:
sudoku

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.