;/*************************************************************************
;** interpcom-1.1 (command interpreter)                                   **
;** magic : a program for the command interpreter                         **
;**                                                                       **
;** Copyright (C) 1998  Jean-Marc Drezet                                  **
;**                                                                       **
;**  This library is free software; you can redistribute it and/or        **
;**  modify it under the terms of the GNU Library General Public          **
;**  License as published by the Free Software Foundation; either         **
;**  version 2 of the License, or (at your option) any later version.     **
;**									  **
;**  This library is distributed in the hope that it will be useful,      **
;**  but WITHOUT ANY WARRANTY; without even the implied warranty of       **
;**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    **
;**  Library General Public License for more details. 			  **
;**									  **
;**  You should have received a copy of the GNU Library General Public    **
;**  License along with this library; if not, write to the Free		  **
;**  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   **
;**                                                                       **
;** Please mail any bug reports/fixes/enhancements to me at:              **
;**      drezet@math.jussieu.fr                                           **
;** or                                                                    **
;**      Jean-Marc Drezet                                                 **
;**      Institut de Mathematiques                                        **
;**      Aile 45-55                                                       **
;**      2, place Jussieu                                                 **
;**      75251 Paris Cedex 05                                             **
;**      France								  **
;**                                                                       **
; *************************************************************************/
;
;
;
; This program computes all 4x4 magic squares (up to permutation of lines
; and columns) and prints them
;
;------------------------------------------------------------------------
:magic
1
0
-1
j=0
do a 2 10 1
do b a+1 16-a/2 1
c=33-a-b
if> c-16 lll0
do x a+1 10 1
if= x-b lll1
if= x-c lll1
do y x+1 16-x/2 1
if= y-b lll2
if= y-c lll2
l=33-x-y
if> l-16 lll2
if= l-b lll2
if= l-c lll2
do u 2 16 1
if< 29-a-u lll3
if= u-a lll3
if= u-b lll3
if= u-c lll3
if= u-x lll3
if= u-y lll3
if= u-l lll3
do v 2 16 1
if< 32-a-u-v lll4
if= v-u lll4
if= v-a lll4
if= v-b lll4
if= v-c lll4
if= v-x lll4
if= v-y lll4
if= v-l lll4
w=34-a-u-v
if> w-16 lll4
if< w-2 lll4
if= w-a lll4
if= w-b lll4
if= w-c lll4
if= w-x lll4
if= w-y lll4
if= w-l lll4
if= w-u lll4
if= w-v lll4
do t 2 16 1
if< 32-u-x-t lll6
if< 29-t-b lll6
if= t-w lll6
if= t-a lll6
if= t-b lll6
if= t-c lll6
if= t-x lll6
if= t-y lll6
if= t-l lll6
if= t-u lll6
if= t-v lll6
do s 2 16 1
if< 32-y-v-s lll7
if< 32-s-t-b lll7
if= s-w lll7
if= s-a lll7
if= s-b lll7
if= s-c lll7
if= s-x lll7
if= s-y lll7
if= s-l lll7
if= s-u lll7
if= s-v lll7
if= s-t lll7
r=34-b-t-s
p=34-x-u-t
q=34-y-v-s
n=34-c-p-q
if< r-2 lll7
if< p-2 lll7
if< q-2 lll7
if< n-2 lll7
if> r-16 lll7
if> p-16 lll7
if> q-16 lll7
if> n-16 lll7
if= r-w lll7
if= r-a lll7
if= r-b lll7
if= r-c lll7
if= r-x lll7
if= r-y lll7
if= r-l lll7
if= r-u lll7
if= r-v lll7
if= r-t lll7
if= r-s lll7
if= p-w lll7
if= p-a lll7
if= p-b lll7
if= p-c lll7
if= p-x lll7
if= p-y lll7
if= p-l lll7
if= p-u lll7
if= p-v lll7
if= p-t lll7
if= p-s lll7
if= p-r lll7
if= q-w lll7
if= q-a lll7
if= q-b lll7
if= q-c lll7
if= q-x lll7
if= q-y lll7
if= q-l lll7
if= q-u lll7
if= q-v lll7
if= q-t lll7
if= q-s lll7
if= q-r lll7
if= q-p lll7
j=j+1
echo % 
echoi j
echo %
echo \n
echoi 1 a b c
echo \n
echoi x u t p
echo \n
echoi y v s q
echo \n
echoi l w r n
echo \n
echo \n
lll7:
enddo
lll6:
enddo
lll4:
enddo
lll3:
enddo
lll2:
enddo
lll1:
enddo
lll0:
enddo
enddo
echo \n
;
