Posts

Showing posts from October, 2013

Conway's Game of Life as a data uri

A while ago I came across a post on Hacker News that showed a version of the game "snake" that someone had built to work from a data uri. When I initially saw it I became obsessed because I though it was pretty neat (and because there wasn't much code). Fast forward a few months and I came up with the idea to attempt the same sort of thing except with Conway's Game of Life.

It's implemented in javascript using the canvas element and requestAnimationFrame (instead of setTimeout or setInterval). Also instead of using a 2d array I've used a 1d array (no lazy dead edges though, it still wraps).

Here's the copy and paste version:
data:text/html,<script>var r=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;document.addEventListener('DOMContentLoaded',function(){for(var e,f,b=256,c=256,d=[],g=2,h=null,i=function(a){(!h||a-h>41.7)&&(f.setTransform(1,0,0,1,0,0…