Jack Morton

Sudoku

December 2022 - February 2023

This sudoku app was my first experience with app development & Kotlin. I aimed to step outside my comfort zone and broaden my experiences. I was also intrigued by the generation of sudoku boards.

The app generates a completed sudoku board using an efficient solving algorithm. This algorithm uses backtracking to identify the first cell with the smallest number of candidates, then attempts to fill it in with each of its candidates in a random order. Afterwards, it removes a given number of cells based on the selected difficulty, and uses the same solving algorithm to ensure there are no new valid solutions.

Screenshot of my Sudoku Android App, showing a game-in-progress.

The game keeps a move stack, so that the player can undo their most recent moves. Each element in the stack also contains information about any notes which were automatically removed, or added via the note auto-fill button. To avoid memory leaks, it is implemented via a deque, and automatically pops the earliest move after the stack reaches a certain size.

I’ve started working on a better method for generating sudokus, which bases difficulty off the techniques required to solve the puzzle, rather than the number of cells removed.


Check it out on GitHub to follow development.


Go back to posts