% Illustrates the perfect shuffle
% Set up a cell array of rgb vectors that range from blue to yellow..
C = cell(52,1);

for k=1:52
    f = (k-1)/51;
    C{k} = [0 f 1-f];
end

close all
figure
set(gcf,'Position',[200 200 800 600])
axis  off
hold on
axis([0 53 0 80])
axis manual
for j = 0:8
   % Display the deck after j shuffles...
   for k=1:52
      fill([k k+1 k+1 k k],6*j+[ 0 0 5 5 0],C{k})
   end
   shg
   pause
   C = Shuffle(C);
end