Magic Figure Generator



Magic figures are a fascinating branch of combinatoric and Ramsey-Theoretic math. A very fun book on the topic which I highly recommend if you want to play with this program extensively is called The Zen of Magic Squares, Circles and Stars by Clifford A. Pickover. After reading his book, I was inspired to make a general-purpose magic figure generation program to further explore the topic. This program is provided to you for personal or academic use, for fun and for free, but please see the license if there are any questions. I don't like the idea of my work being used for profit or redistributed without credit being given.

Documentation
LicenseThe obligatory license. Please read this if you want to redistribute my program or use it for commercial purposes. Also, contact information is there in case you want to submit modified code, bugs, questions, suggestions or plugins to me -- and of course, you'll get your credit.
No detailed instruction manual exists yet. If I find there's a need for one, I'll write a FAQ. In general, you should be able to figure it out from the sample input and the program prompts.
Executable
Compiled ExecutableThe executable. Run it in a command prompt. You may "pipe in" a sample input file below in Windows like this:

>MFG1_2 < inputfilename.txt

Code
Source CodeThe code for the sample driver, support classes, and the default "Depth-First Search" algorithm for finding figures.

Driver.cpp

Algorithm.h
Algorithm.cpp

ADFS.h
ADFS.cpp

DFS.h
DFS.cpp

Magic.h
Magic.cpp

Matrix.h
Matrix.cpp

Range.h
Range.cpp

Rational.h
Rational.cpp

Sample Input
Traditional 3-Sided Magic SquareThe obvious first choice.
Traditional 3-Sided Anti-Magic SquareLike the first one, except where all sums must be different. There are a lot! Can you find any antimagic figures that aren't so easy?
3-Sided Perfect Magic CubeThis doesn't give a solution: It is impossible to make a 3-sided perfect magic cube.It just confirms what was proven mathematically already.
Olympic Rings (cheat)This creates magic "Olympic Rings" like on figure 4.23 of Pickover's book (see above.) This example also demonstrates the ability to "cheat" by using a constant to set a few values before running the program.