Problem :

 

Find the largest Island Order 7 magic square

 

( see topographical model section 1 )

 

 

_________________________________________________________________________

 

Section Below Code for F1 Compiler

Order 7 Magic Square

 

__________________________________________________________________________

 

 

///////////////////////////////////////////////////////////////////////////////

// Looking for Largest Island - Order 7 Magic Square ... Topographical Model

//

// 8 - 3 - 2008

 

 

pred Magic5Assoc(filter:<I) iff

ms::[0..48]->>L[1..49] &

ms = [ a1, a2, a3, a4, a5, a6, a7,

b1, b2, b3, b4, b5, b6, b7,

c1, c2, c3, c4, c5, c6, c7,

d1, d2, d3, d4, d5, d6, d7,

e1, e2, e3, e4, e5, e6, e7,

f1, f2, f3, f4, f5, f6, f7,

g1, g2, g3, g4, g5, g6, g7

] &

 

 

a1 + a2 + a3 + a4 + a5 + a6 + a7 = 175 &

b1 + b2 + b3 + b4 + b5 + b6 + b7 = 175 &

c1 + c2 + c3 + c4 + c5 + c6 + c7 = 175 &

d1 + d2 + d3 + d4 + d5 + d6 + d7 = 175 &

e1 + e2 + e3 + e4 + e5 + e6 + e7 = 175 &

f1 + f2 + f3 + f4 + f5 + f6 + f7 = 175 &

g1 + g2 + g3 + g4 + g5 + g6 + g7 = 175 &

 

 

a1 + b1 + c1 + d1 + e1 + f1 + g1 = 175 &

a2 + b2 + c2 + d2 + e2 + f2 + g2 = 175 &

a3 + b3 + c3 + d3 + e3 + f3 + g3 = 175 &

a4 + b4 + c4 + d4 + e4 + f4 + g4 = 175 &

a5 + b5 + c5 + d5 + e5 + f5 + g5 = 175 &

a6 + b6 + c6 + d6 + e6 + f6 + g6 = 175 &

a7 + b7 + c7 + d7 + e7 + f7 + g7 = 175 &

 

a1 + b2 + c3 + d4 + e5 + f6 + g7 = 175 &

a7 + b6 + c5 + d4 + e3 + f2 + g1 = 175 &

 

 

 

 

////////////////////////////////////// external values

 

a1 = 2 &

a7 = 7 &

g1 = 6 &

g7 = 5 &

 

 

 

////////////////////////////////////// barrier values

 

a2 > 25 &

a3 = 36 &

a4 = 35 &

a5 = 34 &

 

b1 = 33 &

b6 > 26 &

 

c1 = 39 &

c7 = 29 &

 

d1 = 38 &

d7 = 27 &

 

f2 > 26 &

f6 > 26 &

 

 

g3 = 40 &

g4 = 25 &

g6 = 44 &

 

 

///////////////////////////////////////// island values

 

c3 > 26 &

c4 = 26 &

d3 > 25 &

d4 = 47 &

d5 = 31 &

e4 = 30 &

 

 

/////////////////////////////////// Moat values

 

 

b2 < 26 &

b3 < 26 &

b4 < 26 &

b5 < 26 &

 

c2 < 26 &

c5 < 26 &

c6 < 26 &

d2 < 26 &

d6 < 26 &

 

e2 < 26 &

e3 < 26 &

e5 = 49 &

e6 < 26 &

 

f3 < 26 &

f4 < 26 &

f5 < 26 &

 

 

////////////////////////////////// looking for 6th interior "island" cell

// d3 = 26 &

 

 

 

 

 

if filter <> 0 then

Filter(ms)

else

PrettyPrintA(ms,0)

end

 

///////////////////////////////////////////////////////////////////////////////

 

local proc Filter(ms:<[0..48]->>L[1..49]) iff

ms = [ a1, a2, a3, a4, a5, a6, a7,

b1, b2, b3, b4, b5, b6, b7,

c1, c2, c3, c4, c5, c6, c7,

d1, d2, d3, d4, d5, d6, d7,

e1, e2, e3, e4, e5, e6, e7,

f1, f2, f3, f4, f5, f6, f7,

g1, g2, g3, g4, g5, g6, g7

] &

if b2 = b2

then

PrettyPrintA(ms,0)

else

false // you may want to change this to "true" (or comment out)

end

 

 

///////////////////////////////////////////////////////////////////////////////

 

pred Magic5AssocPan() iff

ms::[0..48]->>L[1..49] &

ms = [ a1, a2, a3, a4, a5, a6, a7,

b1, b2, b3, b4, b5, b6, b7,

c1, c2, c3, c4, c5, c6, c7,

d1, d2, d3, d4, d5, d6, d7,

e1, e2, e3, e4, e5, e6, e7,

f1, f2, f3, f4, f5, f6, f7,

g1, g2, g3, g4, g5, g6, g7

] &

b2 = b2 &

PrettyPrintA(ms,0)

 

 

///////////////////////////////////////////////////////////////////////////////

local proc PrettyPrintA(ms:<[0..48]->>L[1..49], i:<I) iff

if i < 7 then

j = i * 7 &

Print('\n') &

PrintDigit(ms(j)) &

PrintDigit(ms(j+1)) &

PrintDigit(ms(j+2)) &

PrintDigit(ms(j+3)) &

PrintDigit(ms(j+4)) &

PrintDigit(ms(j+5)) &

PrintDigit(ms(j+6)) &

PrettyPrintA(ms,i+1)

else

Print('\n')

end

 

local proc PrintDigit(d:<L) iff

if d < 10 then

Print(' ',d,' ')

else

Print(d,' ')

End

 

 

 

 

 

 

 

In the above section you do not have to KNOW ANY PROGRAMING all you have to do

Is put a educated guess as to the values for about half the cells and the program .. will

Generate solutions in a reasonable amount of time for rest of the square ..

 

Perhaps it is like finding the square root with a calculator just push the buttons and let the

Calculator do its work .

 

 

 

 

 

 

 

 

 

Add additional constraints ( initial guess)

 

 

 

 

 

 

 

 

 

 

Looking at this example I fooled around with the parameters and was able to produce a example with 5 cells in the interior being island cells

 

 

 

 

 

 

 

 

What usually happens next .. is I will get excited about my work and email it to Francis Gaspalou . He will take pity on my floundering around and usually send me the general solution with the maximum number of cells possible (see maximum water retention for order 5 magic square)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Adjusting the parameters and looking for solutions .

 

 

 

 

 

1 46 36 35 34 14 9

48 24 17 6 11 47 22

39 20 32 26 16 13 29

38 2 28 45 31 4 27

37 19 10 30 21 15 43

5 41 12 8 18 49 42

7 23 40 25 44 33 3

 

___ Solution: 1 __________________________________

 

1 46 36 35 34 17 6

48 20 18 15 11 47 16

39 12 32 26 23 14 29

38 4 28 42 31 5 27

37 7 13 30 21 24 43

9 41 8 2 22 49 44

3 45 40 25 33 19 10

 

___ Solution: 2 __________________________________

 

1 46 36 35 34 13 10

49 24 20 9 11 47 15

39 16 33 26 18 14 29

38 4 28 45 31 2 27

37 23 6 30 17 19 43

3 41 12 5 22 48 44

8 21 40 25 42 32 7

 

___ Solution: 3 __________________________________

 

1 46 36 35 34 15 8

48 20 18 13 12 47 17

39 9 32 26 19 21 29

38 3 28 42 31 6 27

37 11 16 30 24 14 43

10 41 5 4 22 49 44

2 45 40 25 33 23 7

 

___ Solution: 4 __________________________________

 

1 46 36 35 34 18 5

44 24 21 11 12 47 16

39 14 32 26 20 15 29

38 4 28 45 31 2 27

37 13 10 30 19 23 43

9 41 8 3 17 48 49

7 33 40 25 42 22 6

 

___ Solution: 5 __________________________________

 

1 46 36 35 34 18 5

44 24 21 11 12 47 16

39 15 32 26 20 14 29

38 4 28 45 31 2 27

37 23 10 30 19 13 43

9 41 8 3 17 48 49

7 22 40 25 42 33 6

 

___ Solution: 6 __________________________________

 

1 46 36 35 34 16 7

48 24 14 8 12 47 22

39 23 33 26 15 10 29

38 2 28 45 31 4 27

37 19 11 30 18 17 43

3 41 13 6 21 49 42

9 20 40 25 44 32 5

 

___ Solution: 7 __________________________________

 

1 46 36 35 34 16 7

48 24 14 8 12 47 22

39 23 33 26 15 10 29

38 4 28 45 31 2 27

37 17 11 30 18 19 43

3 41 13 6 21 49 42

9 20 40 25 44 32 5

 

___ Solution: 8 __________________________________

 

1 46 36 35 34 13 10

48 23 20 8 12 47 17

39 14 33 26 16 18 29

38 4 28 45 31 2 27

37 15 7 30 19 24 43

3 41 11 6 21 49 44

9 32 40 25 42 22 5

 

___ Solution: 9 __________________________________

 

1 46 36 35 34 8 15

48 24 16 17 12 47 11

39 13 42 26 23 3 29

38 14 28 33 31 4 27

37 18 6 30 21 20 43

2 41 7 9 22 49 45

10 19 40 25 32 44 5

 

___ Solution: 10 __________________________________

 

1 46 36 35 34 12 11

49 24 18 9 13 47 15

39 10 32 26 16 23 29

38 4 28 45 31 2 27

37 17 7 30 19 22 43

3 41 14 5 20 48 44

8 33 40 25 42 21 6