Make The Finest Magic Code Square In math a magic square is an N&times;N grid of numbers from 1 to N2 such that every row, column, and diagonal sums to the same total. For example here's a 3&times;3 magic square:



In this challenge we'll extend the idea to magic code squares where, instead of numbers, each grid cell is any non-newline character. They can be be repeated and in any order.

And instead of sums, each row, column, and diagonal is viewed as an N-character single-line program whose output is a distinct number from 0 to 2N+1 (inclusive).

For example, if you had a 4&times;4 magic code square that looked like

ABCD
EFGH
IJKL
MNOP


it would need to output the numbers 0 through 9, perhaps like:

  ABCD-9
  EFGH-2
  IJKL-6
  MNOP-5
 /||||\
3 4180 7


That is, the ten embedded 4-character single-line programs that form the rows, columns, and diagonals of the grid each need to output a unique number from 0 through 9. In this case:

ABCD -&gt; 9
EFGH -&gt; 2
IJKL -&gt; 6
MNOP -&gt; 5
AFKP -&gt; 7
DHLP -&gt; 0
CGKO -&gt; 8
BFJN -&gt; 1
AEIM -&gt; 4
DGJM -&gt; 3


(Note that the diagonals are read from top to bottom. This is required.)

As another example, this 3&times;3 code square

d*P
0##
! d


would need to output 0 through 7 when its rows, column, and diagonals are run to make it magical, perhaps like:

  d*P-1
  0##-0
  ! d-6
 /|||\
5 432 7


Scoring

The goal of this challenge is not necessarily to make the smallest or the biggest magic code square. In some programming languages very small magic code squares might be easy to make and in other languages very large ones might be.

The challenge here is to create what you think is the best, most elegant, or most impressive magic code square or related set of magic code squares. Hence this is a popularity-contest, the answer with the highest number of votes wins.


Your submission must include at least one valid magic code square, and may include many related ones if you have found them, or even an infinite neighborhood of them.
Please list the N (or range of N's) you found at the top of your answer.
For submitting multiple magic code squares in the same language but with very different implementations use multiple answers.
Of course you are encouraged to share your process of searching for magic code squares and explain why yours is interesting! (Info about any Parker magic code squares might be funny.)
Keg, 4x4 magic square

0601
7.92
3._.
8654


Try it online!

Outputs


 0601 - 1
 7.92 - 7
 3._. - 3
 8654 - 4
/||||\
98652 0


I can't believe this actually works! Programs need the -hr flag to properly output the required result. 

Test suite. Uncomment each line to run it. The -in flag is purely to make the test suite a nicer experience, as otherwise, the newlines would interfere with the programs.

Programs


0601 - 1 (Push 0, 6, 0 and 1,then print the top of stack (TOS)) 
7.92 - 7 (Push 7 and print it. This makes the rest of the program a NOP) 
3._. - 3 (Push 3 and print it. The _ will the try and pop from an empty stack, ending execution) 
8654 - 4 (Push 8, 6, 5 and 4 and then print TOS) 
0738 - 8 (Push 0, 7, 3 and 8 and then print TOS) 
6..6 - 6 (Push 6 and print it. The . will try and print from an empty stack, end execution) 
09_5 - 5 (Push 0 and 9, then pop the 9 and discard it then push 5. TOS is then printed) 
12.4 - 2 (Push 1, then 2 and print TOS. The rest of the program is NOPs after that.) 
0._4 - 0 (Like the program for 3, but with 0)
19.8 - 9 (Like the program for 2 but with 9)