The outlines have been removed from a set of
dominoes which exactly fill a rectangular board. Given a list of
the dominoes, your task is to figure out where they belong on the board.
Background & Techniques
This puzzle was adapted from the Giant Book of Mensa Mind Challenges,
with several used copies available using the preceding link for under $2.00.
The Mensa version contains several 8X7 boards to fill. This program allows you to
select sizes from 6x5 up to 10x9. It also allows you to "cheat" by
displaying a count of the number of positions where each unplaced domino
could fit on the current board. (I haven't solved one yet without this
aid, which is probably why it is there:>) The program creates
puzzles randomly and allows you to save and restore any puzzles to/from
a file. Dominoes are placed by connecting two numeric values on
the board. Dead ends can be correct by clicking on an in-place
Non-programmers are welcome to read on, but may
want to skip to the bottom of this page to download
executable version of the program.
The program does not yet contain a search for
solutions. A random puzzle of the selected size is created using
calls to the recursive AddDomino function. For each cell , if
not occupied, it attempts to place a domino first horizontally then
vertically, calling itself to place the next one after the placement
There is a "Swappoint" procedure to exchange
two TPoint records. This is used in the AssignValues
procedure called after the dominoes have been placed. Each entry in
the DominoValues array of TPoint records contains the two values for
a domino. For each domino on the board we randomly select a value from
the part of array that has contains only unselected points. That value
is assigned to the domino and then swapped with the point at the end of the
unused area. The size of the unused area is then reduced by1 so that point
will not be selected again.
Dominoes are added to the board by mouse
dragging vertically or horizontally from one unoccupied number
to a neighboring one. Mouse-down, Mouse-move and Mouse- up even exits
are used to monitor what is happening. Clicking on an occupied
area is detected in mouse down exit and the domino removed immediately.
Running/Exploring the Program