PileUp Puzzle

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




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.

Mensa Daily Puzzlers

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.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


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

Search DelphiForFun.org only




Problem Description

Four piles of blocks, each 6 blocks high and containing the letters "A' through "F" are scrambled versions of the "solution" stack.  For each of the 4 stacks, you are given the number of pairs that match the solution stack and the number of pairs that are reversed versions of pairs in the solution stack.  Your job is to reconstruct the solution stack. 

Background & Techniques

The "piles of blocks" aren't the random result of child's play but clues to a final solution stack. Like the rest, this final pile has 6 bricks, each with a different one of the six letters. Your job is to determine the order of the blocks in the final pile.

The numbers below the piles tell you two things:

bulletThe number of adjacent pairs of bricks in the that column also appear adjacent in the same order in the
final stack.
bulletThe number of adjacent pairs of bricks that make a correct pair but are in the wrong order.

This puzzle was adapted from "Logical Puzzles - 320 Teasing Tests of Your Mental Acumen", Chartwell Books
Inc., 2006.

If you want to try to solve it yourself, you can enter letters A through F in the solution column and the current counts of "Inorder" and "Reversed" matches against each of the other stacks will show up in the "User Guesses" box.  When your stack's counts of Inorder and Reversed  pairs matches the numbers comparing each stack to the solution, you've solved it! 

The "Solve" button will solve the puzzle by searching through all 720 possible ways to arrange the 6 blocks in a stack (6 choices for the first block, 5 choices for the second, etc. 6x5x4x3x2x1=720).

The "Create" button will create new random puzzles with unique solutions.

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.

{Program description to be added later - no time today, so it's this or not post  at all.}


Running/Exploring the Program 

bullet Download executable
bullet Download  source

Suggestions for Further Explorations

bulletI had originally planned to use a stack image with blank blocks and draw the letters on the blocks in the image for each stack.  Just ran out of time. 
bullet A "Hint" button could reveal a different letter of the solution for each click.  
bulletI wonder about the "extreme" configurations.
bulletCould a puzzle be created with no matching and no reversed pairs?  If not, what is the minimum sum of "In order" and "Reversed" pair counts?
bullet If the four stacks were not scrambled at all, there would be 5 pairs  in order for each stack (20 in total).  If the stacks were all inverted versions of the solution stack, there would be 5 reversed pairs for each.  Could the sum of the "In order" and "Reversed" counts be 20 for any other configurations?  If not, what is the next highest count possible?
bulletMy Create button filters out all non-unique random puzzles it creates, but I wonder: What is the maximum number of solutions that might exists for a particular puzzle?
Original Date: March 3, 2008

Modified: May 15, 2018


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