Oxygen Basic
Programming => Example Code => Topic started by: Peter on January 21, 2011, 12:55:46 PM
-
Deleted
-
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?
-
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!
-
Finally!
(http://files.allbasic.info/O2/Magic_Square.png)
-
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
-
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.
-
Construction of panmagic squares
This best describes my approach.