# solve str8ts with prolog (puzzle like sudoku)

35 views

### Jörg

Feb 16, 2015, 3:13:54 PM2/16/15
Hi, i want to solve str8ts with prolog.

problem is: first i set the constraints for all rows(fiels which are black and undefined are excluded first)

constraint 1: all_different(rowN)
constraint 2: rows ins 1..9

now i split every row into lists of white boxes --> and check if the group is gapless. if there is a variable undefined -> the variable is filled.

there is the problem. i only want so set the constraint, that the group has to be gapless...

after i set the constraints for all rows and columns, i want to use labeling from clpfd libary.

but i dont know how to set the constraint, that a group is gapless without set variables for the row/column.

`puzzle([[9,1],[6,0],[8,0],[1,0],[_,0],[_,0],[_,0],[4,0],[_,0],[_,0],[_,0],[_,1],[_,1],[4,0],[_,0],[_,0],[7,1],[_,1],[5,0],[_,1],[_,1],[_,0],[3,0],[_,0],[_,1],[_,1],[_,0],[_,0],[_,1],[_,0],[_,0],[_,0],[4,0],[6,1],[_,0],[_,0],[_,1],[_,0],[_,0],[_,0],[_,1],[_,0],[_,0],[_,0],[_,1],[3,0],[_,0],[_,1],[_,0],[5,0],[8,0],[_,0],[_,1],[_,0],[_,0],[_,1],[_,1],[_,0],[_,0],[_,0],[_,1],[5,1],[_,0],[_,1],[_,1],[5,0],[_,0],[_,0],[_,1],[4,1],[1,0],[_,0],[_,0],[7,0],[_,0],[_,0],[_,0],[_,0],[_,0],[_,0],[1,1]]).`