Constraint Lingo Evaluator

Constraint Lingo (CL) is a formalism for expressing the clues in logic puzzles. You can read about it in

Raphael Finkel, Wiktor Marek, Miroslaw Truszczyński, "Constraint Lingo: Towards High-Level Constraint Programming", Software ― Practice and Experience, 34:15, pp 1481-1504, December 2004.
You can look here for a summary of CL syntax.

Consider the Boo! puzzle from Dell Logic Puzzles, October 1999, page 8:

There are four children: Bernadette, Juan, Keisha, and Sam, who dressed in four costumes: crayon, lion, robot, and scarecrow, standing in a row in positions 1 through 4.

  1. Sam, who isn't wearing the Robot costume, is number four.
  2. The child wearning the lion costume is one position after the child wearing the scarecrow costume.
  3. Bernadette is not in position two.
  4. Keisha is two positions aftger the child wearing the crayon costume.

Here is a representation of the puzzle in Constraint Lingo:

CLASS place: 1 .. 4
CLASS child: bernadette juan keisha sam
CLASS costume: crayon lion robot scarecrow

# clue 1
    CONFLICT sam robot
    REQUIRED sam 4
# clue 2
    OFFSET 1 place: scarecrow lion
# clue 3
    CONFLICT bernadette 2
# clue 4
    OFFSET 2 place: crayon keisha

Here is the solution:

        child      costume   place 
        ========== ========= ===== 
        bernadette crayon    1     
        juan       robot     2     
        keisha     scarecrow 3     
        sam        lion      4