Cracker Barrel Triangle Puzzle
Solving the puzzle
|
Years ago while waiting to eat at a Cracker Barrel restaurant I tried to solve
the above puzzle with little success. After many failures the thought
occurred that a solution could be found via a program. My original
effort goes back to about 1974 with a Fortran program on an old IBM 1130.
If I remember right the program took 24 hours to run. I was amazed by
the number of solutions and could not understand why it was so difficult to do manually.
Years later, somewhere in the late 90s the program was rewritten in
Progress, a nice 4GL for accessing a Progress DB but not to swift
with calculations. This ran for about an hour on a HP9000 Unix box.
It was then rewritten in C on the same machine, my one and only C
program and was amazed to find it ran in a few seconds. All of the
above efforts was done only with the case where the program assumed
the top hole was empty.
After the company I worked for went bankrupt, the Unix box disappeared
and the program went with it so I decided to write it from memory in Visual
Basic. This time the problem was solved for all four non-redundant cases.
It ran on a 1GHz Windows PC and finished in approximately 3
minutes. I then checked the web to see if there was any sites that
published a solution and found several. These links can be found under
the triangle puzzle links in the left-hand navigation areas. My favorite
is Dan O'Briens puzzle page
which has a much more extensive analysis than this site.
My solutions were then stored in an Access database and a couple of ASP
pages were written to display up to 100 solutions at a time depending on the parameters
selected by the user. Each solution has a link that will display that single
solution in detail.