

Show HN: HTML5 Game of Life in 24-bit RGB - audiodude
http://rgb.0-z-0.com

======
DougHaber
I always liked the idea of color life. I like that this did one game for each
bit. That's an interesting take on it and the results look nice.

I made a quick color life a few years ago. I wanted the rules to be simple
like life itself, so this is what I came up with:

* Each cell has a color attribute. When generating the initial board, colors are randomly assigned.

* When a new cell is created it inherits the most prevalent color of the surrounding cells, or if there is a tie, any one of the the top colors may be used.

(Randomly assigned colors aren't filtered, so it is possible for dark cells to
exist that are the same color as the background.)

Here is the result:
[http://www.node99.net/content/color_life/index.html](http://www.node99.net/content/color_life/index.html)

~~~
guidopallemans
do you have the source code of this?

I had an awesome idea a long time ago that is almost the same as that, but I
was a CS noob and tried it in Java...

can you throw that on Github with a license?

~~~
DougHaber
Sure. This was based on a life program I wrote in JavaScript a long time ago
that used DIVs, because canvas didn't yet exist at the time. The color version
was made a few years later by taking the nLife code, switching it to use
canvas, and adding the color rules. I just tarred it all up and left in the
nLife license, which I think is BSD w/ advertising clause. You can find the
source here:

[http://www.node99.net/content/nlife/nlife-canvas-
color.tgz](http://www.node99.net/content/nlife/nlife-canvas-color.tgz)

I'm fairly certain from watching it that there is a bug in the selection of
the most dominant color, since sometimes a color that died off manages to come
back. Anyway, if you make it do anything interesting, please share. I'd
definitely like to see.

~~~
guidopallemans
cheers!

------
TazeTSchnitzel
24 parallel games combined in a way indecipherable to normal human eyes isn't
terribly interesting to me.

I find SmoothLife more interesting:
[https://www.youtube.com/watch?v=KJe9H6qS82I](https://www.youtube.com/watch?v=KJe9H6qS82I)

~~~
lgas
If you watch it for a while the patterns in each layer stablize and you end up
with a stable overall pattern. It's often very easy to discern blinkers,
beacons, gliders and the like.

~~~
TazeTSchnitzel
You can only see them on games occupying higher bits, however. Lower bits
(like the 1 or 2 bits, for example) can't be seen by the naked eye.

------
chrisBob
24 parallel games of like != 24 dimensional game. It appears that the
different layers do not interact with each other, or am I missing something?

~~~
scrumper
Exactly - this is 24 separate 2 dimensional Games of Life overlaid on each
other for visual effect.

To be 24 dimensional, the rules would have to be quite different: at each turn
of the game, instead of just considering each cell's 8 neighboring cells on a
2d grid, there'd be 11 additional 2d grids (perhaps represented by different
colors), and you'd evaluate the 8 neighboring cells on each of the 11 other 2d
grids, iteratively, once for each of the 12 grids. Likely this would not run
particularly quickly in a browser (or anything else) for any interestingly
large field.

------
zokier
Wonder if different color mappings (LAB/YUV/HSV) would produce more
interesting results

------
transfire
I tend to to think of black as being dead, and white as very much alive. Would
rather see what this looks like with the colors flipped back around.

~~~
lftl
The pencil is inverted, but other than that this should do it.

[http://lftl.github.io/rgb_of_life/public/](http://lftl.github.io/rgb_of_life/public/)

~~~
audiodude
I looked at your fork and I don't see any commits, how did the code get
updated?

~~~
lftl
I just made the commit to the gh-pages branch. Here's the commit, not that
it's much of anything:

[https://github.com/lftl/rgb_of_life/commit/6be88caab5a8956ff...](https://github.com/lftl/rgb_of_life/commit/6be88caab5a8956ffff1c8bf9dd08046f880c5ca)

------
oxalo
Interesting that each 'layer' doesn't carry the same visual weight, and thus
it's dominated by only three colors.

------
konklone
Man, I love this thing.

For extra beauty, turn on the pencil (it can stay the default color, black)
and click-drag it across the canvas any which way while there are colors
interacting.

It's fascinating to watch the darker colors quickly give way to light ones.

------
chewmieser
Very cool!

I had started on a basic GOL recently as well (HTML5/Canvas):
[http://srolfe.github.io/GameOfLife.js/](http://srolfe.github.io/GameOfLife.js/)

Still very much a WIP, but it was getting there.

~~~
vectorpush
Awesome. This is the best game of life I've seen on the web. It has every
feature you could ever want for someone who enjoys creating patterns
incrementally.

------
lgas
This is very cool. I am working on an implementation of Conway's Game of Life
for the Launchpad S which basically has 8-bit color. So far I only have the
basic game of life working starting from pre-defined patterns. I want to allow
the user to input the starting configuration using the device itself and then
trigger samples based on the evolving patterns. But now I have the next goal
after that -- implement an 8-bit version of this.

The code is in Clojure (it uses Overtone to talk to the Launchpad S) and is
here if anyone is interested:

[https://github.com/lgastako/lifepad](https://github.com/lgastako/lifepad)

------
ewest
I think a better experience is possible with a start button over a static
background to provide the viewer with an idea about what they're about to get
into.

------
rip747
i'm _NOT_ trying to be funny. you should seriously consider putting a warning
page on that site that this could induce seizures or migraines.

~~~
Dylan16807
I can't imagine how this could cause a seizure. Can you provide more
information there?

Migraines I don't know as much about, but I feel like warning people your site
has bright colors isn't very important.

~~~
singold
Well, I'm not an expert, but the w3c Accesibility guidelines say:

 _" 2.3.1 Three Flashes or Below Threshold: Web pages do not contain anything
that flashes more than three times in any one second period, or the flash is
below the general flash and red flash thresholds."_[0]

And also: _" Individuals who have photosensitive seizure disorders can have a
seizure triggered by content that flashes at certain frequencies for more than
a few flashes. People are even more sensitive to red flashing than to other
colors, so a special test is provided for saturated red flashing."_[1]

It is clear that this are only guidelines, not laws, but in this particular
case I think it is appropriate to make some kind of warning for this users.

[0][http://www.w3.org/TR/2008/REC-
WCAG20-20081211/#seizure](http://www.w3.org/TR/2008/REC-
WCAG20-20081211/#seizure) [1][http://www.w3.org/TR/UNDERSTANDING-
WCAG20/seizure-does-not-v...](http://www.w3.org/TR/UNDERSTANDING-
WCAG20/seizure-does-not-violate.html#seizure-does-not-violate-intent-head)

------
pp19dd
Did a morning thing where I opened up a bunch of HN links in different tabs.
Halfway through, my browser started seizing up, operating system becoming
unresponsive. Spent 15 minutes diagnosing, checking about:memory and then
realized - wait a minute, what about the 24 bit RGB Game of Life tab?

Also, pretty =)

------
null_ptr
Looks great, and unlike most web demos this one is fairly light on CPU usage!

------
hakcermani
nice, but would be nice if we could set the number of simulations and speed.
the patterns are not clearly discernable (for me personally).

------
tantalor
Please support touch events.

------
mschuster91
Gives an interesting effect when on weed, probably also true with other
psychoactive drugs.

