The implementation is a combination of
DOM manipulation functionality,
ES5 classes and a problem solving algorithm. Fun fact, I initially implemented the solution in C! To use the app, one had to manually input each Sudoku cell in the console (not much fun). The main reasons for this choice were my familiarity with the language and performance concerns.
Luckily, a more experienced developer and my mentor at the time pointed out that
- My application would be more usable with a GUI
- For a project like this, there is no point addressing performance proactively
At this point you would expect me to quote
Premature optimization is the root of all evil
> Donald Knuth - The Art of Computer Programming, 1974
My emphasis on performance at the time, characteristic of developers straight out of university, manifested itself in one more area. The algorithm I implemented is a combination of
- Heuristics for extracting cell values based on the given cells, similar to what a Sudoku player would do
- A brute force algorithm to calculate the rest
It may be the case that the first approach is redundant, and the second is performant enough for all use cases. Anyway, I really enjoyed implementing the heuristics so it was worth it!
This was also my first exposure to tests. I used some Sudoku (Sudokus ?) of various difficulties to verify that my algorithm was correct. Those are integration tests essentially, but with no testing framework.