What it was
This Christmas I encountered ‘Kurosu’ – a japanese grid-based logic puzzle in the same vein as Sudoku (albeit a lot simpler than Sudoku).
As a Christmas puzzle – and to top-up my coding skills development over the holiday – I set myself the challenge of writing some code to solve all such puzzles. It took a few hours over several days but I managed it in the end (probably wouldn’t be blogging about it if I hadn’t…)
My code uses simple logical induction to eliminate the puzzle grid’s non-solutions, row-by-row and column-by-column.
You can find it at: https://github.com/rr-coding/kurosu-solver
If you don’t want to run it youself you’ll have to take my word for it that it works!
What I learned
Part of the challenge was that I wasn’t allowed to look at anyone else’s solution to this until after mine was working.
I confess admiration for this (very different) solution, which takes a more combinatorial / number-crunching approach – generating the set of all possible valid solutions then simply testing which one is at a hand. Plus – his taut PERL scripting makes my Python look laughably clunky and byzantine!
But I’m trying not to feel completely inadequate – my approach roughly emulates the process a human would use to solve the grid and needs relatively few (4 or so) iterations to settle on a solution.
What I will aim to do differently as a result
- Keep brushing up on my coding – still so much to learn
- Reflect on different approaches to coding and problem solving – think about efficiency not just efficacy of code
Note: I went back and edited this post into my usual learning format after publishing it.