function C=grecoLation(n)
if nargin==0
    n=7;
end
A=zeros(n,n);
B=A;
p=0;
for i=1:n
    for j=1:n
        p=p+1;
        A(i,j)=p;
        B(i,n+1-j)=p;
        if j==n
            p=p-1;
        end
        if p==n
            p=0;
        end
    end
end

% on permute n fois lignes et colonnes
for i=1:n
    rn = fix(n*rand)+1;
    k = fix(n*rand)+1;
    temp=A(rn,:);
    A(rn,:)=A(k,:);
    A(k,:)=temp;
    temp=B(rn,:);
    B(rn,:)=B(k,:);
    B(k,:)=temp;

    rn = fix(n*rand)+1;
    k = fix(n*rand)+1;
    temp=A(:,rn);
    A(:,rn)=A(:,k);
    A(:,k)=temp;
    temp=B(:,rn);
    B(:,rn)=B(:,k);
    B(:,k)=temp;
end

C=zeros(n,3*n);
for i=1:n
    for j=1:n
        C(i,3*(j-1)+1) = A(i,j)+ 64;
        C(i,3*(j-1)+2) = B(i,j)+ 48;
        C(i,3*(j-1)+3) = 32;
    end
end
C=setstr(C);
xgc=[0 1 1 0];
ygc=[0 0 1 1];
xpc=[0.25 0.75 0.75 0.25];
ypc=[0.25 0.25 0.75 0.75];


clf
hold on
couleurs=rand(n,3);
for i=1:n
    for j=1:n
        fill(xgc+j,ygc+i,couleurs(A(i,j),:))
        fill(xpc+j,ypc+i,couleurs(B(i,j),:))
    end
end
hold off
axis equal
axis off


