News for hackers. Stuff that matters.
Re:Conway's Game of Life in HTML 5 by greendestiny on Thursday July 08, 2010 @03:26AM (#1496740)
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.
Re:Conway's Game of Life in HTML 5 by greendestiny on Thursday July 08, 2010 @04:39AM (#1496838)
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);
  } /* > */
Re:Conway's Game of Life in HTML 5 by greendestiny on Thursday July 08, 2010 @04:43AM (#1496844)
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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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>_<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);  } /* > */
Re:Conway's Game of Life in HTML 5 by andreyf on Thursday July 08, 2010 @02:13AM (#1496635)
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.
Re:Conway's Game of Life in HTML 5 by powrtoch on Thursday July 08, 2010 @09:52AM (#1497287)
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.

Re:Conway's Game of Life in HTML 5 by Unseelie on Thursday July 08, 2010 @02:26PM (#1498279)
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.
Re:Conway's Game of Life in HTML 5 by powrtoch on Thursday July 08, 2010 @04:06PM (#1498584)
Rendering the bullets redundant, no?
Re:Conway's Game of Life in HTML 5 by mynameishere on Thursday July 08, 2010 @10:38AM (#1497475)
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.

Re:Conway's Game of Life in HTML 5 by bootload on Thursday July 08, 2010 @07:18AM (#1497024)

     "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...
Re:Conway's Game of Life in HTML 5 by tlrobinson on Thursday July 08, 2010 @07:15AM (#1497018)
Does this even use any HTML5 features, or did it just need a buzzword?
Re:Conway's Game of Life in HTML 5 by CoryMathews on Thursday July 08, 2010 @09:27AM (#1497219)
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.

Re:Conway's Game of Life in HTML 5 by aralib on Friday July 09, 2010 @02:28AM (#1499943)

  {"width": 52, "cells": "AAAAABgAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAACIAAAEEAAAEEAAAAgAAACIAAABwAAAAgAAAAAAAAAAAAAHAAAAHAAAAIgAAAAAAAAYwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}
Re:Conway's Game of Life in HTML 5 by zacclark on Thursday July 08, 2010 @12:12AM (#1496469)
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.
Re:Conway's Game of Life in HTML 5 by mcgyver on Thursday July 08, 2010 @12:23AM (#1496483)
Is there a stash of interesting imports available anywhere?
Re:Conway's Game of Life in HTML 5 by FiReaNG3L on Thursday July 08, 2010 @07:50AM (#1497062)
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"}

Re:Conway's Game of Life in HTML 5 by InclinedPlane on Thursday July 08, 2010 @12:11PM (#1497793)
You've also managed to mangle the formatting of this entire page.
Re:Conway's Game of Life in HTML 5 by jacquesm on Thursday July 08, 2010 @01:42AM (#1496596)
Re:Conway's Game of Life in HTML 5 by dchs on Thursday July 08, 2010 @04:15AM (#1496806)
Who clicked expecting something to do with Ron Conway?
Re:Conway's Game of Life in HTML 5 by tlrobinson on Thursday July 08, 2010 @07:16AM (#1497020)
Non-programmers?
Re:Conway's Game of Life in HTML 5 by ThomPete on Wednesday July 07, 2010 @11:39PM (#1496407)
Doesn't work on the iPad.
Re:Conway's Game of Life in HTML 5 by ihodes on Thursday July 08, 2010 @12:26AM (#1496486)
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.

Re:Conway's Game of Life in HTML 5 by ugh on Thursday July 08, 2010 @12:02AM (#1496451)
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.

Re:Conway's Game of Life in HTML 5 by lionhearted on Wednesday July 07, 2010 @11:33PM (#1496395)
Wow. It's so beautiful.