Comments on: Mathematical Recreations: Tweetable Game Of Life https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/?s_tid=feedtopost Loren Shure is interested in the design of the MATLAB language. She is an application engineer and writes here about MATLAB programming and related topics. Wed, 18 Aug 2010 20:46:19 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Ken Eaton https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31601 Wed, 18 Aug 2010 20:46:19 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31601 In case you’re interested, someone made a code golf challenge on Stack Overflow:

http://stackoverflow.com/questions/3499538/code-golf-conways-game-of-life

]]>
By: Tobin Fricke https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31063 Wed, 10 Feb 2010 02:02:14 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31063 Heh! The same APL video also inspired me to write a Life program in Matlab. Not quite tweetable, however!

http://nibot-lab.livejournal.com/tag/life

]]>
By: Andrew Kraev https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31056 Sun, 07 Feb 2010 16:02:34 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31056 Hello,
here is simple code to calculate for an optional vector a[i], i=1,..,n the sum by i of products, containing multipliers (for all j!=i) such as a[j]/(a[j]-a[i]). It can be proved that for all vectors this expression equals to 1. The code does not contain any loops:

A=x'*ones(size(x));
B=A./(A-A'+diag(x));
res=sum(prod(B))
]]>
By: Aslak Grinsted https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31051 Fri, 05 Feb 2010 15:24:27 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-31051 Here’s another fun piece of code inspired by cellular automata. This one generates what looks like a labyrinth… I made it as a music visualizer for winamp many years ago.

And now i re-implemented it in matlab.

c=-ones(5); c(2:4,2:4)=2;
c(3,3)=13; c=c/8;
A=rand(300)>.99;
close all
colormap gray
for ii=1:100; A=max(min(filter2(c,A),1),0); imagesc(A==0); drawnow; end;

]]>
By: Matt McDonnell https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30993 Thu, 21 Jan 2010 17:58:14 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30993 Aslak-
Very nice! I like your abs(filter2(…)…) approach, although I think the conv2 with 1D vectors will still win in terms of speed for large arrays.

I’m working on an approach using accumarray and the integral image of ‘a’ (google Viola-Jones for reference), I’ll add it to the thread when I get it working.

Now, if we can just get HashLife into a tweet…

-Matt

]]>
By: Aslak Grinsted https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30990 Thu, 21 Jan 2010 13:33:33 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30990 And a high-life version:

a=rand(256)>0.8;
for ii=1:500,spy(a);drawnow;f=filter2(ones(3),a);a=(f-6)+2*a==0|f==3;end

Test with this initial “a”:

a=zeros(200);
a(101:105,101:105)=[0 0 1 1 1;0 1 0 0 1; 1 0 0 0 1;1 0 0 1 0;1 1 1 0 0];
]]>
By: Aslak Grinsted https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30989 Thu, 21 Jan 2010 09:57:12 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30989 Fun :-). Just tried a few tricks to shorten it further… This is what i got:

a=rand(128)>0.8;
for ii=1:500,spy(a);drawnow;a=abs(filter2(ones(3),a)*2-6-a)<2;end

]]>
By: Loren https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30986 Wed, 20 Jan 2010 21:30:37 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30986 Gabe-

Spell my name as my parents did and you will find me on twitter. I am not very active there. Matt was the real author of this particular post.

–loren

]]>
By: Gabe https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30984 Wed, 20 Jan 2010 19:45:24 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30984 Is Lauren on Twitter btw? Failed to find her.

]]>
By: Leon Palafox https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30981 Wed, 20 Jan 2010 08:47:46 +0000 https://blogs.mathworks.com/loren/2010/01/19/mathematical-recreations-tweetable-game-of-life/#comment-30981 Hello

I am a big fan of your blog, and usually I spent some time trying to figure out the ways you reduce in one line what I would spend like 4.

Keep up the good work, and keep good programs coming.

Leon

]]>