Overview
For our final project for CS50, my group of four was assigned to build a sudoku creator (that would generate a board with only one solution) and solver. I was responsible for implementing the sudoku solver, server/client architecture, and larder size boards. Testing was also implemented.
Class
COSC 50: Software Design & Implementation
Timeline
May - June 2022 (3 weeks)
Tools
C, Bash, Git
./sudoku solver
The sudoku solver solves any size sudoku board. The user inputs the size of the board and the board itself and the program outputs a solution for it. It finds a solution by iterating through the board and when it finds an empty tile collecting all the possible digits that could go there. It then chooses a digit at random and continues. If a solution does not exist it backtracks and tries a new number. If there are no more possible numbers it returns that there's no solution.
A sample usage of the solver
./sudoku create
The creator uses the solver to generate new sudoku boards. It starts by getting a filled in sudoku board by passing an empty board to the solver. Then it randomly chooses tiles and sees if there is still a unique solution for the board if you were to remove it. If there would still be a unique solution, it removes it and continues.
A sample usage of the creator
./sudoku_server
We integrated the creator with a server. The client (user) sends a request to the server with the size of the sudoku board and then the server creates a board of that size and sends it back.
The server uses a TCP architecture and the Berkeley Sockets API
The server outputs logging information to show its progress
./sudoku play
We also created a 'play' mode that allows the user to actively solve a solution in real time.
A sample play mode
the interface we made to visualize the process
Lastly, we created a GUI in Python so that people could see the sudoku board in a nicer format than the command line.
The GUI showing a solved sudoku board; it shows the difference between user inputted numbers and numbers that are parts of the board