Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Conway's Game of Life in HTML 5 (sixfoottallrabbit.co.uk)
50 points by kf on July 8, 2010 | hide | past | favorite | 23 comments


Html5, pfft :) Many years ago I wrote a version of the Game of Life where the html to display a step of the game was both html and c code that could be compiled and run - the output being the duel html/c code for the next iteration. It involved the horrendous of abuse of what netscape (this was 1996 or so) would accept as html, and lots of #defines for the c code. This was for the international obfuscated c code competition - I thought it was pretty badass, but it didn't win. When I dug up the code many years later, I don't think I could ever really get another browser to accept the "html" so maybe it was a better idea than implementation.


Hey I found the code, this first iteration actual reads a file in '.lif' format or a simplified version thereof, and then produces the duel html/c code:

  /*<!-- */
  #include<stdio.h>
  
  char *s="/*<!-- */char *s=%c%s%c;char *t=%c%s%c;%c#define O (x[a][b++]=1),0%c#define _ (x[a][b++]=0),0%c#define TD 5; 4%c#define TR a++; b=1;%c#define Tr a++;%c#define N(x) f=x+1;%c#define p printf%cint main() {  int x[99][99],a=1,b=1,i,j,k,l,n,f;    for(i=0; i<99; i++) for(j=0; j<99; j++) x[i][j]=0;    p(s,34,s,34,34,t,34,10,10,10,10,10,10,10,10);/*--%c <HTML><TABLE border=0><TR><TD */5>";

  char *t="      for(i=1; i<a; (i!=(a-1))?p(%c%%cTR /*%%c%%cTD*/5%%c%cn%c,60,62,60,62):i,i++)        for(j=1; j<b; j++) {          n=0;          for(k=-1; k<2; k++) for(l=-1; l<2; l++) if(k||l) n+=x[i+k][j+l];          p(%c%%c%c,(n==3)?'O':((n==2)?(x[i][j]?'O':'_'):'_'));          j!=(b-1)?p(%c%%cTD%%c%c,60,62):j;        }      p(%c%%cTr N(%%d)/*%%c%%c/TABLE%%c%%cA HREF=t%%d.c%%cn%%c/A%%c%%c/HTML%%c%%cTD */%cn%c,        60,f,62,60,62,60,f,62,60,62,60,62,60);      p(t,34,92,34,34,34,34,34,34,92,34,10);  } /* > */%c";


  int main() {
    int x[999][999],i,h,v,minx=999,miny=999,maxx=0,maxy=0;
    char str[99],nstr[99],done;

    printf(s,34,s,34,34,t,34,10,10,10,10,10,10,10,10,62);

    for(i=0; i<999; i++) for(v=0; v<999; v++) x[i][v]=0;
    v=0; h=0;
    while(!feof(stdin)) {
      fgets(&str[0],98,stdin);
      i=0;
      if(sscanf(&str[0],"#P %d %d \n",&h,&v)|sscanf(&str[0],"#%s \n",nstr)|feof(stdin)) { }
      else {
          while(str[i]!='\0'&&str[i]!=EOF) {
          (str[i]!='.'&&isgraph(str[i]))?x[500+h+i][500+v]=1:i;
          (500+h+i)<minx?minx=(500+h+i):((500+h+i)>maxx?maxx=(500+h+i):i);
          (500+v)<miny?miny=(500+v):((500+v)>maxy?maxy=(500+v):v);
          i++;
        }
      }
      v++;
    }

    for(v=(miny-11); v<(maxy+12); v++)
     for(i=(minx-11); i<(maxx+10); i++)
      printf("%c<%s",x[i][v]?'O':'_',i==(maxx+9)?(v==(maxy+11)?"Tr N(2)\n":"TR /*><TD */5>\n"):"TD>");

    printf("/*></TABLE><A HREF=t2.c>n</A><BR><TD */\n");

    printf(t,34,92,34,34,34,34,34,34,92,34,10);
  } /* > */


And the output looks like, the trick is to define TD and TR as incrementors of the row and column counters and '_' and 'O' as statements which set the relevant place in the array. This is all an overshare, I get that, I'm just excited to find the code.

  /*<!-- */char *s="/*<!-- */char *s=%c%s%c;char *t=%c%s%c;%c#define O (x[a][b++]=1),0%c#define _ (x[a][b++]=0),0%c#define TD 5; 4%c#define TR a++; b=1;%c#define Tr a++;%c#define N(x) f=x+1;%c#define p printf%cint main() {  int x[99][99],a=1,b=1,i,j,k,l,n,f;    for(i=0; i<99; i++) for(j=0; j<99; j++) x[i][j]=0;    p(s,34,s,34,34,t,34,10,10,10,10,10,10,10,10);/*--%c <HTML><TABLE border=0><TR><TD */5>";char *t="      for(i=1; i<a; (i!=(a-1))?p(%c%%cTR /*%%c%%cTD*/5%%c%cn%c,60,62,60,62):i,i++)        for(j=1; j<b; j++) {          n=0;          for(k=-1; k<2; k++) for(l=-1; l<2; l++) if(k||l) n+=x[i+k][j+l];          p(%c%%c%c,(n==3)?'O':((n==2)?(x[i][j]?'O':'_'):'_'));          j!=(b-1)?p(%c%%cTD%%c%c,60,62):j;        }      p(%c%%cTr N(%%d)/*%%c%%c/TABLE%%c%%cA HREF=t%%d.c%%cn%%c/A%%c%%c/HTML%%c%%cTD */%cn%c,        60,f,62,60,62,60,f,62,60,62,60,62,60);      p(t,34,92,34,34,34,34,34,34,92,34,10);  } /* > */%c";
  #define O (x[a][b++]=1),0
  #define _ (x[a][b++]=0),0
  #define TD 5; 4
  #define TR a++; b=1;
  #define Tr a++;
  #define N(x) f=x+1;
  #define p printf
  int main() {  int x[99][99],a=1,b=1,i,j,k,l,n,f;    for(i=0; i<99; i++) for(j=0; j<99; j++) x[i][j]=0;        p(s,34,s,34,34,t,34,10,10,10,10,10,10,10,10);/*--> <HTML><TABLE border=0><TR><TD   */5>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TR /*><TD */5>
  _<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<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_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<TD>_<Tr N(2)
  /*></TABLE><A HREF=t2.c>n</A><BR><TD */
        for(i=1; i<a; (i!=(a-1))?p("%cTR /*%c%cTD*/5%c\n",60,62,60,62):i,i++)        for(j=1; j<b; j++) {          n=0;            for(k=-1; k<2; k++) for(l=-1; l<2; l++) if(k||l) n+=x[i+k][j+l];          p("%c",(n==3)?'O':((n==2)?(x[i][j]?'O':'_'):'_'));          j!=(b-1)?p("%cTD%c",60,62):j;        }      p("%cTr N(%d)/*%c%c/TABLE%c%cA HREF=t%d.c%cn%c/A%c%c/HTML%c%cTD */\n",        60,f,62,60,62,60,f,62,60,62,60,62,60);      p(t,34,92,34,34,34,34,34,34,92,34,10);  } /* > */


Here's something I've been meaning to ask someone: are there patterns that can "survive" in some degree of random static in a GoL board? As in, are there spaceships which can fly through other patterns on the board (either leaving behind other patterns, or acting as an "eraser")? Note that they don't necessarily have to "survive" in emptiness.


Plenty of patterns can survive in some degree of static. One of the rules is "Any live cell with two or three live neighbours lives on to the next generation." Therefore, a spaceship cell that normally had two neighbors could run into an extra blip, and there would be no effect.

As far as specific patterns that are just generally resilient, Life patterns tend to be pretty fragile, and I would expect this to be an unavoidable consequence of the game's rules, one that would scale to any complex construction you built.

Also, I'm not going to attempt a proof but it sure seems that for any pattern X, you could construct a (pretty simple) pattern Y than would destroy it.


Assume a slower moving boat which fires quick boats forward. In that the 'bullets' would interact with the pattern first, you have a possibility of the things destroying everything in the path of the slow boat. Could work, but the boat itself would need to destroy everything in its path.


Rendering the bullets redundant, no?


The applet at the top left contains a large number of interesting patterns.

http://www.ibiblio.org/lifepatterns/

I think the "stargate" pattern is similar to what you're asking.


     "Bill Gosper discovered the first glider gun 
     (and, so far, the smallest one found) in 1970, 
     earning $50 from Conway. The discovery of the 
     glider gun eventually led to the proof that 
     Conway's Game of Life could function as a 
     Turing machine."
fascinated by this quote ~ https://secure.wikimedia.org/wikipedia/en/wiki/Gun_%28cellul...


Does this even use any HTML5 features, or did it just need a buzzword?


I have used some in a few projects, that said its limiting because of support by browsers.

But its more of a buzzword, lots of people call things html5 even when its not.


  {"width": 52, "cells": "AAAAABgAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAACIAAAEEAAAEEAAAAgAAACIAAABwAAAAgAAAAAAAAAAAAAHAAAAHAAAAIgAAAAAAAAYwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}


Somehow, even after programming my own version of the game of life, I can still sit there watching it evolve. It never ceases to amaze me how such a set of simple rules can cause such interesting behavior.


Is there a stash of interesting imports available anywhere?


I just made a Gosper Glider gun

{"w":200,"h":200,"cells":"A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/ANMAfDA/A/A/A/AqDgAeBEAfggAeIIAfQAfRAfDgAfQA/AhDgAf4AfRA/ADGA/A/A/A/A/ALMAfDA/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/A/At"}


You've also managed to mangle the formatting of this entire page.



Who clicked expecting something to do with Ron Conway?


Non-programmers?


Doesn't work on the iPad.


Works just find on mine!

Always loved the Game of Life. Programmed in Python & OpenGL a while back, but this is just cool. Glad to play with it every once in a while.


It does work on my iPod touch (iOS 4). I had to touch a bit longer to change cells and I couldn’t touch and drag to change cells but all the rest works just fine.

It’s a bit slow, though. 20 Hz looks rather like 2 Hz.


Wow. It's so beautiful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: