Fork me on GitHub

Einstein's Puzzle

Einstein's puzzle, stated here, is a classic constraint problem. In common with Sudoku, it does not use transitions and uses the "all different" design pattern.

This puzzle also utilizes multiple symbol lists. After creating a symbol list with a name, you can specify that a board cell uses that symbol list by stating board-cell:symbol-list-name. It is invalid to connect one symbol list to another using a temporary variable.

Here we also utilize Opt, which stands for Option. For instance we can state that either the object House indicates the Englishman is in a red house, or the nationality and house have other values than Englishman and red. These groups of options (opt-groups) are formed using the option name. We continue in this vein for all the rules to properly model the problem.

Opt cl1:House { red Englishman ? ? ? }
Opt cl1:House { !red !Englishman ? ? ? }

source | solution