• fullscreen
  • wolframs_dream.pde
  • int x,y,i,n,s=256,c=#000000,r=110;
    void draw(){
    	for(y=s;y>=0;y--)
    		for(x=0;x<s;x++){
    			for(i=n=0;i<3;i++)n=2*n+(get((x+i-1+s)%s,y-1)==c?1:0);
    			set(x,y,x==mouseX&y==mouseY|(r>>n&1)>0?c:-1);
    		}
    }
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    bitcraft
    Luis Gonzalez
    10 Sep 2009
    I only see static for this sketch and pascal dream:
    http://yfrog.com/0ocaphg

    try this (192Chars):
    int x,y,i,n,s=256;void setup(){size(s,s,P2D);}void draw(){for(y=s;y--&gt;=0;)for(x=0;x&lt;s;){for(i=n=0;i&lt;3;)n=2*n+(get((x+i++-1+s)%s,y-1)&lt;-1?1:0);set(x,y,x++==mouseX&y==mouseY|(110&gt;&gt;n&1)&gt;0?0:-1);}}
    bitcraft
    11 Sep 2009
    thanks!

    that's very weird ... the mumble jumble on your screenshot looks unlike any rule 110 pattern I've seen before :) Was it my use of set() on pixels outside the visible screen area that leads to strange behaviour in some Java engines when relying on Java2D? In this case "for(y=s-1;y&gt;=0;y--)" or "for(y=s;y--&gt;=0;)" - as you suggested - should do the trick...

    I guess you could then drop the setup() function to squeeze out even more characters :-)
    I like the compactness of your suggestion, but since I have posted some very cryptic sketches before, I decided to optimize for code readability for a change :)

    I think I'll simply increase the sketch size to 256x257 pixels and leave the code unchanged. Could you check if this fixes the problem for you?
    bitcraft
    11 Sep 2009
    Hey, I located the origin of the problem!
    If you open this sketch in two browser tabs at the same time it gets totaly fucked up (and looks exactly like the screenshot you posted)
    This is related to a bug that DotLassie has reported before. (http://www.openprocessing.org/visuals/?visualID=4278)

    Just close one of the tabs and the other cellular automaton will magically clean up again.
    This is really interesting - it seems like the java sandbox principle does not work as expected when running two instances of the same applet. I will try to come up with a sketch that makes use of this wormhole bug ,,,
    Luis Gonzalez
    11 Sep 2009
    I still see the static. I think it will go away if you put the P2D in there.
    You need to login/register to comment.