Rally (Marble Puzzle)

[Home]   [Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

 

Available Now

Search

Google
 

Search WWW             

Search delphiforfun.org

Contact

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

Help support DFF

 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.

 

Google
 

Search WWW

Search delphiforfun.org

 

 

 

Problem Description

Rally is a puzzle with 32 marbles colored as shown and  free to rotate in the horizontal or vertical oval tracks.  The objective is to rearrange the marbles by rotating them so that the 12 red marbles in the center square are replaced by blue marbles.


Background & Techniques

This puzzle is from a fun book, "1000 PlayThinks", written by Ivan Moscovich and published by Workman Publications.  I hope they don't mind my implementing this one in Delphi.   A move is defined as rotating marbles in the vertical or horizontal tracks in either direction by as many positions as desired.   Moscovich's solution takes 10 moves, but that is far from optimum.  I found a solution on the web that solves the puzzle in 3 moves!   I'm not publishing it here because you might want the fun of discovering it for yourself.  If not, you might want the fun of searching the web to find the solution or sending me a feedback email  requesting the solution.

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.

The program has about 400 lines of user written code - but  half of that is in the Redraw procedure which draws the track and sets marble positions based on the current screen size.   Track and marbles are dynamically resized based on window size.  

A TSlots record defines a marble slot including its current color, and rectangles defining its base location and intermediate positions 1/3 and 2/3 of the way to the next slot in a clockwise direction.  These intermediate positions are used to animate marble moves.    HSlots and VSlots are arrays each containing 18 TSlot records representing the 18 marbles in horizontal and vertical tracks..    Four marble positions overlap between the two tracks and when one track is rotated then common positions in the other track must be updated.  Procedure SynchForm accomplishes this after each move. 

 

Running/Exploring the Program 

Suggestions for Further Explorations

All of the solutions I have found so far have the yellow marbles displaced from their original locations.  Is it possible to exactly exchange the red and blue marbles leaving the yellow marbles in place?
I haven't attempted yet to analyze the game to allow the computer to solve it or give hints.   One of these days........

 

Original Date: January 7, 2003 

Modified: September 08, 2006

 

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