An implementation of Conway's Game of Life in only 90 bytes of JavaScript.
See the demo: http://output.jsbin.com/zebuxi
life (
input, // input array
target, // target array
width // width of stage
)
- Originally Created by Martin Kleppe (@aemkei) at Ubilabs.
- New Version Created by Alexei Barnes (@Alexei_Barnes) at AlexeiBarnes.com.
See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.
Worked on the classic game of life and got a 92 byte result with the same functionality as previous iterations, as well as a 118 byte result with wrapping issues fixed, which can be seen here: http://output.jsbin.com/zebuxi
I decided to use arrow functions when I noticed they were implemented on chrome and firefox, which saved quite a few bytes in combination with Array.prototype.map. I also implemented a flattened walk loop instead of a precalculated walk as most other implementations I've seen, which saved bytes even without the arrow functions.
I encourage you to check out the javascript as I wrote it because I left a history of changes by copy pasting into a new line every iteration: http://jsbin.com/zebuxi/edit?js
Thanks to @aemkei I've really enjoyed reading the code you've written for 140bytes and on your website, a real inspiration.