Code Golf: Conways Game of Life – Stack Overflow

function l(f,N),
  b=char(importdata(f))>46;
  for c=1:N,
    b=~fix(filter2(ones(3),b)-b/2-3);
  end;
  dlmwrite('out.txt',char(b*42+46),'')

The Perl solution edged out the MATLAB solution by one character, but to my eye the MATLAB solution is significantly more legible.

Code Golf: Conways Game of Life – Stack Overflow.

Advertisements