# A mazegic square

So you like mathematical diversions? Here's something new for you then

 ┌───┬───┬───┐
│ 4 │ 9 │ 2 │
├───┼───┼───┤
│ 3 │ 5 │ 7 │
├───┼───┼───┤
│ 8 │ 1 │ 6 │
└───┴───┴───┘

Magic number: 93


Whats that you say? That's just a magic square? And its magic number is only 15, not 93?

No sir, you're wrong, its a MAZEGIC SQUARE! Let me explain...

• You start in space 4 (with a value of 4)
• All movement is orthogonal; up, down, left, or right only.
• Each time you move you change your value based on the direction moved, and the number moved to:
• Moving LEFT subtracts the destination from your current value
• You may not make a move that would result in any of the following:
• A value less than zero
• A value greater than one hundred
• A noninteger value
• If at any time you are in a cell on the edge of the square and your value is the MAGIC NUMBER, you can escape the maze.

So, what cell do you escape from? What is your path through the MAZEGIC SQUARE?

Not-quite-a-hint / reassurance

Your path through the mazegic square is 8 or less operations long (not including entering the maze or escaping it).

Here is a short path that I believe works.

Down ($\times3$): $12$
Up ($\div4$): $3$
Right ($+9$): $12$
Right ($+2$): $14$
Down ($\times7$): $98$
Left ($-5$): $93$
Down ($\times1$): $93$

• This is the shortest path i was looking for! May I ask how you went about finding this solution? I have more of these based on larger magic squares, but I'm worried about producing content that boils down to "do a manual brute-force tree traversal"... that's not a puzzle, that's tedium. – crcroberts Jun 25 '18 at 20:23
• I tried to work backwards and figure out what the last multiplication should be, deciding that it must be $\times1$. The rest I found by chance after random trial and error. I think working backwards is in general a good strategy. – noedne Jun 25 '18 at 21:55
• hah, ironic, given that my whole inspiration here was a maze without walls so you couldn't work it out backwards! thanks for the feedback though – crcroberts Jun 26 '18 at 1:51

Well, here's a path that's surely not optimal (based on the spoiler), but it works, I think?:

Go right, your value is now 3+9 = 12. Go left, your value is now 12-4 = 8.
Now, going right and then going left results in adding 5 to your value each time. So do this 17 more times and you win! (You won't reach over 100, as your last step takes you from 88 to 97, and then 97 to 93.)

Long path, two cells only.

Right (13), Left then Right (+5) sixteen times to add 80, giving us 93.

Yet Another alternative path, bit longer.

DOWN (4*3) = 12;
DOWN (12*8) = 96;
RIGHT(96+1) = 97;
LEFT(97-8)=89;
RIGHT(89+1) =90;
RIGHT(90+6)= 96;
LEFT(96-1)= 95;
LEFT(95-8)=87;
RIGHT(87+1)=88;
RIGHT(88+6)=94;
LEFT(94-1)=93;
DOWN(EXIT)