Here is a good thing to think about:
http://en.wikipedia.org/wiki/Kakuro
I am trying to make a solver for this game. Documents are executed (reading the source file with a variable number of columns and rows. It is assumed that the input file complies with the rules of the game, so the game is always solvable. Do not rush to read the rules of the game.
I took care of the data structure, which, in my opinion, would best fit:
struct aSquare { int verticalSum; int horizontalSum; int value; }
And made an "array" of these dynamically to work. I made the black squares have a value of -1 and the white squares (the actual squares of the solution) were initialized to 0. You can also easily get the position of each aSquare structure from an array, you do not need to create additional structure fields for it.
Now the algorithm ... How in the world can I reconcile all these amounts and find a common way that solves all types of grids. I struggled with this all day to no avail.
Help is appreciated, have fun!
* EDIT: I just realized that the actual link that I posted has some tips regarding the solution methods. Anyway, I will keep track of what people come up with.
c algorithm
Qosmo
source share