27 ms·
nice implementation! The color adds a lot of visual interest. Here's my monochrome implementation. http://wsb.im/conway/index.html http://wsb.im/conway/index.h
by wsbail29 14y ago
nice implementation! The color adds a lot of visual interest. Here's my monochrome implementation.
http://wsb.im/conway/index.html http://wsb.im/conway/index.html
- jlarocco 14y agoHere's a non-literate, Javascript version I made using WebGL for the graphics: https://github.com/jl2/WebGL-Stuff/tree/master/life_game https://github.com/jl2/WebGL-Stuff/tree/master/life_game And the "live" code: http://jlarocco.com/life_js/index.html http://jlarocco.com/life_js/index.html Seems Conway's Game of Life has been popular lately.
- gsabo 14y agoBravo 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.