CA-nvas

SuperHappyDevHouse #34 was today, and I had an absolutely amazing time. This was the best devhouse ever for me — huge thanks to Tom’s Mom for letting us trash their palatial estate yet again. Take a look at some photos from SHDH 34.

This was the first devhouse where I’ve ever actually successfully made anything. It’s an implementation of one-dimensional cellular automata in JavaScript, which was really just an excuse to learn more about the <canvas> tag. Check it out: CA-nvas. Use the little drop-down at the top to choose between a few interesting patterns. If you’re not using Chrome or Safari, it’s gonna be slow. Even Firefox 3.5 chokes a bit.

I was inspired to do so by the first available chapter of Dive Into HTML 5 (“Let’s Call It a Draw(ing Surface)“) of , recently released by Mark Pilgrim. It’s absolutely gorgeous to look at, and incredibly well-written. It gave me all of the information I needed to get started.

Now, as for the one-dimensional cellular automata bit. It sounds really complicated, but it’s actually stupid simple.

Imagine a sheet graph paper. Each row is a “generation”. For the first row, just fill in some blocks at random. That’s the “seed”. Now, to figure out what the next row should look like, you just apply this rule to each of the blocks: look at the three blocks above it — that is, the one directly above it and the ones to the left and right of that one. You have 8 possible combinations for these “ancestors” — all of them are off, just the one to the right is on, the one in the middle is on, etc. For each of these combinations, you have a rule to tell you whether the block in the next row should be turned on. It’s these different rules that lead to different patterns on your sheet of paper.

That’s it! AMAZING patterns just fall out of this thing. It’s even been speculated that the patterns on mollusk shells are generated by an algorithm similar to this. I love this stuff. You should take a few minutes to learn a bit more about cellular automata, because they’re easy to understand, and will blow your mind.

And on that note, I’m out of here.

Comments

Victoria

What time does your Mum arrive on Staurday?

Steve

Hmm its like “The Singularity is Near” all over again.

Victoria

Everyone arrived safely. =D They say hi!

Keddy@work

I thought I should come on here and tell everyone who I might not have on facebook that I am engaged to Christine now!!! Hurray!!! Its freaking awesome, I was so friggin nervous all week since I bought the ring on tuesday but on saturday I asked her to marry me and she said YES! So I am now a fiance!

Victoria

Congratulations!!! Thats amazing!

Keddy

Thanks!

Victoria

I have two questions Mark. The first, what time do you get in on sat? And would you be able to get a fridge magnet from Giardelli square off fishermans warf? Its from Liz!

Victoria

Also what is your flight number?

Mark Christian

I emailed you my flight info.

Victoria

Thank you! Wasn’t sure if you’d fallen out with me or not. Haven’t heard from you in ages. Your very busy I take it?

Mark Christian

Busy/lazy/forgetful, pick one. :)

Victoria

lol. All of the above. You excited about coming over?

Mark Christian

Totally. Except for the 16.25 hour travel time.

Anonymous

I noticed that. Bummer. Well we can’t wait till you get here! =D

Victoria

That last one was me. Sorry.

Angie

Congratulations Ryan!!! Very happy to hear your news.

Keddy

Thanks Angie!

Victoria

Don’t forget the cool whip! =D

Mark Christian

What? I thought you guys wanted Fluff! I bought Fluff. :/ I don’t think Cool Whip would survive being unrefrigerated for 16 hours. :(

Victoria

Yeah, I figured as much. Can’t wait to see you aand neither can your mom!

Keddy

Christine and I are home owners… well sort of, the closing date is on Oct 26th.

Mark Christian

Woah, sweet. Pics or it didn’t happen.

Victoria

Take it you got home ok?

Keddy

I have a pic on facebook!

Leave a comment