I have some problems with solving puzzle. I haven't found solution for this puzzle anywhere, but I tried to write it in Prolog, but I think my solution won't be fast (I generate every solution and delete them if they aren't possible or correct). This is my problem: (I found a name of that puzzle, here is the link with all rules of that puzzle: http://en.wikipedia.org/wiki/Kuromasu). Now I have a different question, which method would be the quite easy to write and quite fast to solve it in Prolog. I thought about transforming my list of fields into a undirected graph, or maybe there is another method to search my list vertically (head after head)?
In:
0, 0, 0, 5, 0, 0, 0
0, 5, 0, 0, 0, 0, 2
0, 0, 0, 0, 7, 0, 4
0, 0, 0, 0, 0, 0, 0
8, 0, 13,0, 0, 0, 0
5, 0, 0, 0, 0, 6, 0
0, 0, 0, 8, 0, 0, 0
Result:
0, #, 0, 5, 0, 0, #
0, 5, 0, 0, 0, #, 2
0, #, 0, #, 7, 0, 4
#, 0, 0, 0, 0, 0, #
8, 0, 13,0, 0, 0, 0
5, 0, 0, 0, #, 6, 0
#, 0, 0, 8, 0, 0, #
This type of puzzles is called Kuromasu. Here is a page that solves it with SWI-Prolog and finite domain constraints: http://jfoutelet.developpez.com/articles/kuromasu/