v1.5: with Neural Network algorithm.
Made for the Algorithms Contest by ACM-W, 2021
Check out the Youtube video for the algorithm and code explanations.
It is a small Pygame simulation to solve sudokus. It shows how different algorithms behave - you can see how various algorithms, like Backtracking, Graph-coloring and Deep Learning operate in real-time.
Once you have pygame and the virtual environment setup, clone this repository, and install the requirements.
$ git clone https://github.com/PratikshaJain37/Algorithms-Contest-Sudoku
$ pip3 install -r requirements. txt
After making sure you are in the directory which contains the code, run the 'main' script using python3
$ cd Algorithms-Contest-Sudoku
$ python3 main.py
A pygame window will appear, with a sudoku grid.
You can press:
- 'b': To solve with backtracking
- 'g': To solve with graph-coloring
- 'n': To solve with deep learning
- 'f': To toggle speed (default=Slow)
- 'spacebar': To reset the board
In helpers.py, there is a function called get_board()
, which holds the board to be solved. You can change the board there, but make sure to keep the board as a list of lists (9x9).
- You cannot run graph-coloring twice in the same pygame :/
- Implement way to detect sudoku from image, and solve it.
- Implement Stochastic search/optimazation methods
- Implement Constraint Programming (CSP)
- Implement scanning (traditional methods)
If you have some suggestions, feel free to raise an Issue and submit a pull request!
- Altered the Pygame UI from TechWithTim's project (His video was the one that actually inspired me to make this project!)
- Graph connections - Ishaan Gupta. Check out his code here and his very thorough blog post here
- Neural Network Model - Shiva Verma. Check out his code here, and his really well written blog here.
This project is licensed under the MIT License.