From UBC Wiki



Zhe Li, Yifei Chen, Yixin Wang

What is the problem?

This project intends to construct a Sudoku solver to help player solve the sudoko game. The player can construct and fill in a sudoku by repetitively putting numbers to certain coordinator. The solver consumes the input from player, and computes the solution.

What is the something extra?

The smallest sudoku that can be solved with one possible solution has 17 known numbers. Therefore, we ask the player to give the solver at least 17 numbers as the input. Then the solver will solve the sudoku and player can choose whether he/she needs a hint or solution.

A hint is to give the first empty cell in the present sudoku while a solution is present the solution computed by the solver directed on the screen. Player can do the sudoku and give his/her intermediate step to the solver to check if he/she is on the right track, which means if that number is placed on that position, then the solver will check whether there is one possible solution. When there is no solution, the solver will report to the player that the game is not solvable.

We will give player the solution of each step by clearing printing it on the terminal. Also player can save his/her intermediate steps to the disk such that he/she can use it later.

What did we learn from doing this?

The design of the project is top-down and the construction of the project is bottom-up. We first think of the whole process of Sudoku and then design helper functions to assist us building the project. Implementation and testing is done after the design to check for the good functionality of the project.

Functional programming is quite useful in implementing the Sudoku game because we have lots of recursions which can be implemented by helper functions.

From this project, we gradually know how to think functionally and get used to writing in Haskell. We learn how to use IO to get input from the player and print a neat display on the console. Due to time limit and some software problem, we are not able to implement a GUI but we have done a search on it and know a few stuff on the gtk library.

Links to code etc