%   cornelia

%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION. 


breakstatus=0;
breakstatus2=0;
breakstatus3=0;
index=1;
lineindex=1;
                                                                     
while breakstatus==0
breakstatus=1;
index=index+1;
reihe=norepex(3,1,180);
einser=find(reihe==1);
zweier=find(reihe==2);
dreier=find(reihe==3);

reihe(einser(xofrandperm(20,60)))=4;


while breakstatus2==0
breakstatus2=1;
indices=xofrandperm(20,60);
reihe(zweier(indices))=5;

for i=1:179
    if  (reihe(i)==4 | reihe(i)==5 ) & (reihe(i+1)==4 | reihe(i+1)==5 )
      breakstatus2=0;
      reihe(indices)=2;
      break
    end
end
index=index+1;
if index>20
    fprintf('.');
    index=1;
    lineindex=lineindex+1;
end
if lineindex>20;
    fprintf('\n');
    lineindex=1;
end
end

fprintf('\n*');

while breakstatus3==0;
breakstatus3=1;    
indices2=xofrandperm(20,60);
reihe(dreier(indices2))=6;
for i=1:179
    if  (reihe(i)==4 | reihe(i)==5 | reihe(i)==6) & (reihe(i+1)==4 | reihe(i+1)==5 | reihe(i+1)==6)
      breakstatus3=0;
      reihe(indices2)=3;
      break
    end
end
index=index+1;
if index>20
    fprintf('.');
    index=1;
    lineindex=lineindex+1;
end
if lineindex>20;
    fprintf('\n');
    lineindex=1;
end
end


end

reihe