Skip to main content
added 28 characters in body
Source Link
Rainer P.
  • 2.5k
  • 1
  • 11
  • 13

#Octave, 169179 bytes

A=' *';C=D=E=zeros(25,80);B=[i=1,1,(1:78)*0];do if i++>25 B=B&0;end
C=[B(randperm(80));C(1:24,:)];D=[B(randperm(80));D(1:24,:)];F=D;D=E;E=F;disp];F=D;D=E;E=F;pause(.1);disp(A((F|=C|D)+1))
until(~F)
A=' *';                               % Index with 1,2 to translate to ' ','*'
                                      % A([2 1 2 2 1]) => '* ** '
C=D=E=zeros(25,80);                   % Locations of fast snowflakes,
                                      % slow ones moving on frame 1,3,5...
                                      % and slow ones moving on 2,4,6...
B=[1,1,zeros(1,78)];                  % Line with two snowflakes in it.
                                      % Will be added on top each frame.
i=1;
do
  if i++>25                           % We push 4 snowflakes per iteration.
    B=B&0;                            % Stop new input after 25 iterations.
  end
  C=[B(randperm(80));C(1:24,:)];      % Shift fast snowflakes down
                                      % and add randomly permuted input line.
  D=[B(randperm(80));D(1:24,:)];      % Shift one set of slow snowflakes down
                                      % and add randomly permuted input line.
  F=D;D=E;E=F;                        % Swap the two sets of slow snowflakes.
  pause(.1);
  disp(A((C|D|E)+1))                  % Print '*' where either of the matrices
                                      % is set, ' ' otherwise.
until(~(C|D|E))                       % Loop until the matrices are all zero

#Octave, 169 bytes

A=' *';C=D=E=zeros(25,80);B=[i=1,1,(1:78)*0];do if i++>25 B=B&0;end
C=[B(randperm(80));C(1:24,:)];D=[B(randperm(80));D(1:24,:)];F=D;D=E;E=F;disp(A((F|=C|D)+1))
until(~F)
A=' *';                               % Index with 1,2 to translate to ' ','*'
                                      % A([2 1 2 2 1]) => '* ** '
C=D=E=zeros(25,80);                   % Locations of fast snowflakes,
                                      % slow ones moving on frame 1,3,5...
                                      % and slow ones moving on 2,4,6...
B=[1,1,zeros(1,78)];                  % Line with two snowflakes in it.
                                      % Will be added on top each frame.
i=1;
do
  if i++>25                           % We push 4 snowflakes per iteration.
    B=B&0;                            % Stop new input after 25 iterations.
  end
  C=[B(randperm(80));C(1:24,:)];      % Shift fast snowflakes down
                                      % and add randomly permuted input line.
  D=[B(randperm(80));D(1:24,:)];      % Shift one set of slow snowflakes down
                                      % and add randomly permuted input line.
  F=D;D=E;E=F;                        % Swap the two sets of slow snowflakes.
  disp(A((C|D|E)+1))                  % Print '*' where either of the matrices
                                      % is set, ' ' otherwise.
until(~(C|D|E))                       % Loop until the matrices are all zero

#Octave, 179 bytes

A=' *';C=D=E=zeros(25,80);B=[i=1,1,(1:78)*0];do if i++>25 B=B&0;end
C=[B(randperm(80));C(1:24,:)];D=[B(randperm(80));D(1:24,:)];F=D;D=E;E=F;pause(.1);disp(A((F|=C|D)+1))
until(~F)
A=' *';                               % Index with 1,2 to translate to ' ','*'
                                      % A([2 1 2 2 1]) => '* ** '
C=D=E=zeros(25,80);                   % Locations of fast snowflakes,
                                      % slow ones moving on frame 1,3,5...
                                      % and slow ones moving on 2,4,6...
B=[1,1,zeros(1,78)];                  % Line with two snowflakes in it.
                                      % Will be added on top each frame.
i=1;
do
  if i++>25                           % We push 4 snowflakes per iteration.
    B=B&0;                            % Stop new input after 25 iterations.
  end
  C=[B(randperm(80));C(1:24,:)];      % Shift fast snowflakes down
                                      % and add randomly permuted input line.
  D=[B(randperm(80));D(1:24,:)];      % Shift one set of slow snowflakes down
                                      % and add randomly permuted input line.
  F=D;D=E;E=F;                        % Swap the two sets of slow snowflakes.
  pause(.1);
  disp(A((C|D|E)+1))                  % Print '*' where either of the matrices
                                      % is set, ' ' otherwise.
until(~(C|D|E))                       % Loop until the matrices are all zero
Source Link
Rainer P.
  • 2.5k
  • 1
  • 11
  • 13

#Octave, 169 bytes

A=' *';C=D=E=zeros(25,80);B=[i=1,1,(1:78)*0];do if i++>25 B=B&0;end
C=[B(randperm(80));C(1:24,:)];D=[B(randperm(80));D(1:24,:)];F=D;D=E;E=F;disp(A((F|=C|D)+1))
until(~F)

##Ungolfed

A=' *';                               % Index with 1,2 to translate to ' ','*'
                                      % A([2 1 2 2 1]) => '* ** '
C=D=E=zeros(25,80);                   % Locations of fast snowflakes,
                                      % slow ones moving on frame 1,3,5...
                                      % and slow ones moving on 2,4,6...
B=[1,1,zeros(1,78)];                  % Line with two snowflakes in it.
                                      % Will be added on top each frame.
i=1;
do
  if i++>25                           % We push 4 snowflakes per iteration.
    B=B&0;                            % Stop new input after 25 iterations.
  end
  C=[B(randperm(80));C(1:24,:)];      % Shift fast snowflakes down
                                      % and add randomly permuted input line.
  D=[B(randperm(80));D(1:24,:)];      % Shift one set of slow snowflakes down
                                      % and add randomly permuted input line.
  F=D;D=E;E=F;                        % Swap the two sets of slow snowflakes.
  disp(A((C|D|E)+1))                  % Print '*' where either of the matrices
                                      % is set, ' ' otherwise.
until(~(C|D|E))                       % Loop until the matrices are all zero