[Community Puzzle] Hitori solver

First and foremost, I would like to thank @VilBoub for creating this puzzle. I loved every bit of it.

It’s important to say that like any good puzzle it’s a rabbit hole (in the good sense). I was not familiar with the Hitori game, and found it fascinating to dive into it’s techniques and strategies.

Then I started solving the puzzle. The test cases are superb. They go from easy to hard (cases 1…4), but still doable using straight-forward simple computation.

Case 5 is different, and this is were the puzzle moves from medium/hard to very hard, and requires backtracking in order to arrive to the solution. It adds a whole new layer to the program. Beautiful.

The validation cases are also excellent, as they revealed I had a bug in one of my functions (after passing cases 1-5).

One funny thing to mention - I saw this puzzle in my notification and got interested, and didn’t realize it’s under the “Very hard”. So I was light-hearted when solving it, until I realized (in case 5) that things are not as easy as they seem :slight_smile:

Excellent puzzle, well constructed. I loved it !

1 Like

Sorry to say that the validators are not enough.
I just got for chance a code that solve all validators, without solving the test 5.

Thank you for your message !

My inspiration for all these puzzles (Mines sweeper) is the magazine “Tangente - Jeux & Stratégies” which unfortunately no longer exists …

My creations
https://www.codingame.com/training/expert/minesweeper.
https://www.codingame.com/training/expert/hitori-solver.
https://www.codingame.com/training/hard/dominoes-solver.
https://www.codingame.com/training/hard/dumbbells-solver.

But for those who are interested in these types of puzzles, there is an international competition (to solve them with your brain, not with a computer^^)

Here are examples of such puzzles:



Shop : http://www.infinimath.com/ (in french !)

1 Like

Hi #VilBoub ,
you should emprove the validator 5, since it is solvable with a code that doen’t take into account the rule: “all un-shaded squares create a single continuous area”.
If you want I can send you such code.
Regards,
G.

#geppoz,
I do not understand … If one of the rules is not respected, then it is not a solution!

look this post:

and try to submit this code:

Hi @VilBoub

First thanks for this puzzle, really interesting.

I managed to have a code that successfully passes the IDE tests. However it fails on the fith validator. Of course I don’t have a clue on what fails (and I promise I did not hardcoded anything!)
I probably do something wrong, that is not checked in the test cases. Could I share my code someway to see where my algorithm fails, and eventually improve the IDE test case?

1 Like

Thanks for @VilBoub for all the interesting puzzles he posted.
For me these were the ‘low-hanging fruits’ to get the “Reach a 100% score on three very hard puzzles.” and “Reach a 100% score on three hard puzzles.” achievements.
With the same standard backtracking algorithm I could solve Hitori, Minesweeper, Dumbbells, Dominoes, n Queens, Sudoku and Mini Sudoku puzzles, with only minor modifications (to implement the game-specific rules). Many medium puzzles needed more time & effort than all these combined, at least for me.

1 Like

Doesn’t sound like a bad thing to me :wink: !

No, I did not mean it as bad thing. I enjoyed all these puzzles.