Author Topic: Magic Square  (Read 3520 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Magic Square
« on: January 21, 2011, 12:55:46 PM »
Deleted
« Last Edit: April 11, 2015, 09:06:02 AM by Peter »

JRS

  • Guest
Re: Magic Square
« Reply #1 on: January 21, 2011, 07:20:19 PM »
I seemed to have missed the beginning of the show. When I download these examples there is a DLL and a include file with no source to a program that uses them or an executable to try. Are you guys trying to redefine fun?


Charles Pegge

  • Guest
Re: Magic Square
« Reply #2 on: January 22, 2011, 03:14:41 AM »

Peter,

I have not cracked the puzzle yet but I am afraid if I continue there will be no time left for coding!

I'm collecting all your demos and would like to package them for posting on sourceForge at some point if that is okay with you.

Are you going to show us the source code for A.dll?

Charles

PS: After leaving the partial solution up for a few hours - it suddenly solves itself!

JRS

  • Guest
Re: Magic Square
« Reply #3 on: January 22, 2011, 09:07:38 PM »
Finally!


Charles Pegge

  • Guest
Re: Magic Square
« Reply #4 on: January 22, 2011, 11:12:03 PM »
Peter,

For your examples would it be possible to include the posted code in the zip file. Copying & pasting from the web page takes a number of steps and can introduce errors.)

Regarding the puzzle: there must be an algorithmic way of solving this but it eludes me so far. :)

Charles

JRS

  • Guest
Re: Magic Square
« Reply #5 on: January 23, 2011, 01:50:29 AM »
Quote
Regarding the puzzle: there must be an algorithmic way of solving this but it eludes me so far.

My guess would be to assign a home value of 24 for each square in the matrix. Its about summing the result of any move towards its home position.

If 1 being in the upper left corner equals 24, moving in any direction that doesn't achieve it's home position returns a negative axis value for its current misplaced position. After doing the math, you know what the best move is by a linked list of ranked moves based on the current board arrangement. I may have over simplified this but thats how I would attempt to solve the puzzle mathematically.
 

JRS

  • Guest
Re: Magic Square
« Reply #6 on: January 23, 2011, 02:07:39 AM »
Construction of panmagic squares

This best describes my approach.