Problem Description
On a standard 8x8 chessboard (or preferably, a quadrille paper
facsimile), make straight diagonal cut from the top left corner of the 2nd
square in the first row to the bottom right corner of the board. Slide
this piece one square up and to the left along the cutline. Then clip the
small triangular piece from the bottom right corner and move it into the hole
at the top left corner. You now have a rectangular board which is 7
squares wide by 9 squares high containing, of course, 63 squares.
What happened to the 64th square?
Background & Techniques
This fallacy is puzzle #413 from the book "Amusements in
Mathematics" by H. E. Dudeney, Dover Publications. I won't
spoil the puzzle by exposing the fallacy here but the program will reveal all.
Fallacy or Paradox?
What's the difference? A paradox represents a seemingly
logical inconsistency. A fallacy results from faulty reasoning.
Dr,
Math at mathforum.org has the following concise definitions:
"A paradox is something that seems to be false, but is
true.
Example: There are just as many even integers as there are integers.
A fallacy is something that seems to be true, but is false.
Example: Every infinite set has the same number of elements." 
Nonprogrammers are welcome to read on, but may want
to skip to the bottom of this page to download
executable version of the program.
300 lines of code put this program in the
Intermediate category. From the programmer's view, there were two
fun
challenges in drawing the 2nd set of images (as the fallacy is exposed)  drawing the board to show the
squares with diagonal cuts and then filling in the squares . A little "experimental
algebra" provided the proper line equations to let us draw
boundaries which ended on the proper pixel in the diagonal
cutlines. I call it experimental algebra because my mathematical
analysis usually provides a first approximation of the correct
equations. Vertical screen coordinates increasing in a
downward direction plus my coding errors usually mean that I spend a while
fiddling to get things looking right. For the second
problem, filling the partial squares with the proper color, I used Delphi's
implementation of the Floodfill procedure. This
procedure has a few "gotcha's" as well, Diagonal pixels are
treated as adjacent, so trying to recolor one square of the chessboard, (for example coloring that bottom right triangle green to erase
it), can easily recolor all of the matching squares on the
board. I used Moveto
and Lineto procedures to outline squares where necessary in order to limit the
scope of Floodfill calls.
Running/Exploring the Program
Suggestions for Further Explorations
Now that we know how to draw a chessboard, problems #289 through #361 in
the Dudeney book mentioned above are all chess puzzles. Some of the
them are surely good candidates for Delphi programs,
Original Date: September 29, 2002 
Modified:
February 18, 2016

