Course:CPSC312-2024-sudokuexpert

From UBC Wiki

Authors: Julian Kennedy, Ilya Patrzykat

What is the problem?

Our goal is to create a functional Sudoku solver in Prolog.

Basic features will include:

  • Following official Sudoku rules as specified by Maki Kaji, also known as the "Father of Sudoku".
    • All rows must contain all numbers 1-9, with no repeating numbers
    • All columns must contain all numbers 1-9, with no repeating numbers
    • All 3x3 boxes must contain all numbers 1-9, with no repeating numbers
  • Generate a valid solution for any valid input where a solution is possible.
  • Correctly process user input into a Sudoku board and output complete Sudoku solution in the form of the Sudoku board using ASCII in the Prolog command line.

What is the something extra?

Our extension will be a new "create" mode that allows users to generate a solvable sudoku board with a specific difficulty (easy, medium, hard).

The method we used required obtaining a valid board first, then removing numbers from that valid board. There are 6 sextillion possible boards so a completely random valid board is extremely difficult (maybe impossible) to generate within the given time contraints. So instead we populated the board with a few random numbers (10 on average) and then used our own "solve" mode to generate a valid board.

What did we learn from doing this?

  • We learned a lot related how to build an application in Prolog like how to run outside the prolog application, taking user input, and how to design a larger program.
  • Sudoku logic puzzles work well in Prolog because you only have to define the rules of a valid sudoku and it finds one. Different way of thinking about programming.
  • Generating Sudoku puzzles is hard.

Work division

  • Ilya took ownership of "solve" mode.
  • Julian took ownership of "create" mode.
  • While we each took ownership of a different mode, we worked closely on both.
  • The work was divided equally. We used Live Share on VSCode during collaboration sessions.

Links to code etc.

https://github.com/JulianKennedy/SudokuSolver