As of October, 2016, Embarcadero is offering a free release
of Delphi (Delphi
10.1 Berlin Starter Edition ). There
are a few restrictions, but it is a welcome step toward making
more programmers aware of the joys of Delphi. They do say
"Offer may be withdrawn at any time", so don't delay if you want
to check it out. Please use the
link to let me know if the link stops working.
Support DFF - Shop
If you shop at Amazon anyway, consider
using this link.
We receive a few cents from each
Support DFF - Donate
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.
For over 15 years
Mensa Page-A-Day calendars have provided several puzzles a year
for my programming pleasure. Coding "solvers" is most fun,
but many programs also allow user solving, convenient for "fill
in the blanks" type. Below are Amazon links to the
two most recent years.
365 Puzzlers Calendar 2017
365 Puzzlers Calendar 2018
(Hint: If you can
wait, current year calendars are usually on sale in January.)
e-mail with your comments about this program (or anything else).
We are given a set of 4 special dice. They are six
sided dice but have between 1 and 7 dots per side and the number per side may be repeated.
The dice are "fair", i.e .,each side is equally likely to be the top face when the die is thrown.
In this particular set, one of the dice has 1,1,5,5,5,5 dots on its sides. The whole
set has a peculiar property. If we label them appropriately as A, B, C, and D, then roll
them in pairs and compare the number of dots on the top face, we get the following
|A beats B 2/3 of the time|
|B beats C, 2/3 of the time,.|
|C beats D, 2/3 of the time, and|
|D beats A 2/3 of the time!!!|
Can you find the configuration of the other three dice?.
Once a set is found, you can define a game where player 2 (you) has a definite advantage, Just
let player 1 select which die to roll and you can always choose one which will, on average,
Background & Techniques
Here's a program which solves puzzles illustrating the non-transitive nature of probability.
The best description I've found is at this
Math Association page
Transitivity is an important property of the "size" relationship that allows us to solve
algebra and logic puzzles. Transitivity for relationship "R" means that if A "R" B is true and B
"R" C is true then A "R" C is true. For example: If A=B and B=C then A=C; If A>B and B>C then
It does not hold true however for the more complex "defeats" relationship. For example, in the
"Rock, Scissors, Paper" game: "Rock defeats Scissors" and "Scissors defeats Paper"
does not imply that "Paper defeats Rock".
The default parameters will solve the puzzle as stated above page, but you can experiment
with other configurations.
Run times depend on the number of sides per die, the maximum
dots per side and the the maximum number of dice allowed in a set that forms the
non-transitive loop, where the last die in the set defeats the first die. The minimum
probability box sets minimum chance of winning if played as a
game where you let your opponent choose his die first and then you choose the die preceding his choice in the set. The begin search from box can be used to
specify a starting die configuration in case a prior partial search was interrupted.
Finally, since dice are difficult to physically produce, you can click on any
solution line to view and/or print a set of cards representing a set of dice.
This has the advantage that we can consider "dice" with 3, 5, 7,
9, sides which would impossible to construct in the real world as fair
dice. Fronts of the cards represent the dots on a die side and
unique card back designs distinguish the dice.
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.
We use our TGraphSearch control to
define the nodes of a graph - nodes are all possible arrangements of dots
on die sides. For each of these we define edges as those
dice which this node beats with at least the minimum probability
specified. Now it is simply a matter of performing a depth
first search looking for a "path", ordered set of dice, with the
property that the last die defeats the first with probability greater than
or equal to the specified minimum.
Searches can be long, so the Solve button
label is changed to a "Stop" button while the search is
running. My usual technique to interrupt any program with long
running loops is to use the stop button click to set a Tag property
to a non-zero value. The loop initializes Tag to zero and
then checks the value within the loop and stops on a nonzero
value. It's important to call Application. ProcessMessages
occasionally within the loop to allow a Stop button click to do it's
A separate Tabsheet to display and/or print a
playing card version is made active when the user clicks on any
solution. The search is also stopped if it is still running when the
click is made. The playing cards simulate dice results by using one
card for each die face and assigning a unique random card back design for
each die. In the current version, cards are laid out assuming
landscape page orientation.
I've added units UTGraphSearch and UCardComponentV2 to the DFF Library
zip file as part of our ongoing move to keeping commonly used items in a
Running/Exploring the Program
Suggestions for Further Explorations
card layout when cards are to be printed. The program should
determine the number of rows and columns and best page orientation
to maximize the size of individual card images.
Definitely doable, I just got tired of working on this silly
|Original Date: June 05, 2005
July 29, 2017