Hacker News new | past | comments | ask | show | jobs | submit login

Here's a non-literate, Javascript version I made using WebGL for the graphics: https://github.com/jl2/WebGL-Stuff/tree/master/life_game

And the "live" code: http://jlarocco.com/life_js/index.html

Seems Conway's Game of Life has been popular lately.




Bravo on making it work with WebGL! It's super smooth.

I see we both went with variable names like 'up' and 'left' for the subscripts in the "neighbor count" code. I'm always looking for ways to sidestep numerical array indexing because it's such a fertile ground for bugs. For example, I find it really hard to look at:

var up = i-1>0 ? -1 + i : -1 + h;

...and tell if it's correct. I used a mod_wrap function instead, which is an implementation of Python-like modulo, which 'wraps' negative numbers to the top of the range.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: