A Chessboard Fallacy

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

Search

Search WWW

Search DelphiForFun.org

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 feedback 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 purchase.   Thanks.


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.

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

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 cut-line. 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."

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.

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 cut-lines.   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 

bulletDownload source
bulletDownload  executable

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

 
  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2017, Gary Darby    All rights reserved.