fponticelli wrote:Hello Forum, I am trying to generate nice looking and engaging Kakuro puzzle for an app I am building. I searched this forum and the internet and found some information but not a lot of guidance. What are the best strategies to achieve the goal? I already have a brute force solver that is good enough to find unique solutions and I think I can generate empty schemas quite easily, the problem is how to fill those with sensical digit
Hi Ponticelli
Welcome to this forum.
I've never generated kakuros, but I've solved a lot of them. And there's the general top-down procedure in Sudoku that can be applied to generate almost any logic puzzle.
There are several steps you'll need to take:
1) decide the size of the grid; small sizes tend to have trivial solutions (but not always);
2) decide the positions of the blacks cells, in particular whether there will be almost closed regions; such regions allow to trivially cut the puzzle into several almost independent pieces; whether this is desirable or not depends on one's opinion about them; this allows to have arbitrarily large grids that remain easy to solve (but probably boring);
3) once the pattern of black cells is fixed, fill in the white cells with digits respecting the non-repeating conditions in each sector;
4) fill in all the black cells with row and column sums;
5) decide whether you want pure Kakuro (no data in the white cells) or not;
6) depending on your answer to the previous question, erase all or part of the white cell data;
7) check that there's a unique solution; if not, add white cell data or restart from 3 (or 2)
8) progressively erase horizontal or vertical sums until you get a puzzle that fits your criteria for goodness.
.
Notice that minimality of the data is not taken into account because the normal solver doesn't care about it.
But you can easily add it, as in any top-down generator.
As an example of interesting Kakuros, check the ATK website:
https://www.atksolutions.com/games/kakuro.html. IMO, they have the best Kakuros.