Examples

The following are the examples located in the example directory.

send+more=money
The “Hello world” of constraint programming. Shows the basic usage with some linear and distinct constraints.
send+most=money
Similar to the above, but also shows an example of optimization search.
Sudoku
The popular puzzle solved using constraint programming. Shows how to use matrices and set propagation strengths.
Sudoku with sets
The sudoku puzzle again, but this time using sets and a different viewpoint. Shows how to use set operations.
N-queens
Shows how to use distinct with offsets.
Magic sequence
Uses the count constraint and some implied constraints.
Nonograms – a.k.a. Paint by Numbers
Uses regular expression constraints to solve the popular logic puzzle.
Square tiling
Uses symmetry breaking and implied constraints to speed up the search.
Minesweeper
Minesweeper solved using constraint programming.
Survo puzzle
The Survo puzzle solved using constraint programming.
Additionally, the following websites may be of interest:
hakank’s Constraint Programming Blog
A blog containing several example models along with the author’s accounts of Gecode/R.
Gecode’s example models
Gecode/R is a Ruby interface to Gecode. Hence Gecode’s example models can typically be translated constraint by constraint into Ruby.