TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A Readable Conway's Game of Life

39 点作者 gsabo大约 13 年前

10 条评论

ihodes大约 13 年前
Very cool, and nice code. Just to be pedantic (I mean it in the best way), this isn't quite literate programming.<p>A very basic explanation would be: literate programming is the result of writing a program in a sort of psuedo-code that explains the program in the order of the programmer's thoughts, and then running it through a compiler of sorts which "untangles" the literate program and outputs machine-readable code.<p>The linked post is nicely formatted and well-documented "regular" code.
评论 #3876685 未加载
评论 #3876690 未加载
agentultra大约 13 年前
The simplest version (and by my yard-stick is the de-facto measure of "readability") I've seen was at Pycon 2012 (<a href="http://azd325.github.com/Python/2012/03/23/pycon-2012-stop-writing-classes/" rel="nofollow">http://azd325.github.com/Python/2012/03/23/pycon-2012-stop-w...</a> around 17:30). The main take away that is demonstrated is that classes aren't necessary to write this program but it's the first thing most programmers reach for when implementing it.<p>Another thing I find a lot these days are an abundance of comments that explain what the code already explains. Some of the comments are good in this example, but many of them explain what I would know if I just read the code.<p>However, I do like the use of color! A great demonstration. Good work. :)
评论 #3877273 未加载
fsiefken大约 13 年前
Reminds me of an even more reabable coffeescript example posted a year ago on HN: <a href="http://willbailey.name/conway/docs/conway.html" rel="nofollow">http://willbailey.name/conway/docs/conway.html</a>
losvedir大约 13 年前
And, conversely, an unreadable Game of Life in one line of APL (with explanation): <a href="http://www.youtube.com/watch?v=a9xAKttWgP4" rel="nofollow">http://www.youtube.com/watch?v=a9xAKttWgP4</a>
评论 #3876855 未加载
评论 #3876751 未加载
wollw大约 13 年前
I've been working on a sculpture project[1] based on cellular automaton for the past two semesters. It's not exactly conway's game of life as I'm mostly focused on polygonal cells. Hardware wise it's mostly just LEDs with shift registers and an ATtiny85 but the code[2] might be interesting to some, in particular dealing with figuring out what cells are and aren't neighbors when you have an ambiguous layout. I've also put together an Android simulator[3] I use for exploring ideas that defines designs using JSON but I've put a lot less work into it.<p>[1] <a href="http://wollw.github.com/automaton-avr/" rel="nofollow">http://wollw.github.com/automaton-avr/</a><p>[2] <a href="https://github.com/Wollw/Cellular-Polymaton" rel="nofollow">https://github.com/Wollw/Cellular-Polymaton</a><p>[3] <a href="https://github.com/Wollw/Polymaton" rel="nofollow">https://github.com/Wollw/Polymaton</a>
jastanton_大约 13 年前
Oh what the heck, because we're all sharing our Conways Attempts here is mine: <a href="https://github.com/JAStanton/conways-game-of-life" rel="nofollow">https://github.com/JAStanton/conways-game-of-life</a><p>And the live version: <a href="http://www.jastanton.com/experiments/conways-game-of-life/" rel="nofollow">http://www.jastanton.com/experiments/conways-game-of-life/</a><p>Mine acts more like a game, you can start and stop with 's' and enter draw mode with 'd' and draw on the cells.
评论 #3876755 未加载
ertdfgcb大约 13 年前
somewhat unrelated: The most beautiful implementation of life that I have ever seen is this 7 line Clojure one. It really turned me on to the value of using data structures that match the problem well.<p><a href="http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/" rel="nofollow">http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/</a>
huhtenberg大约 13 年前
Another idea for colors is to use progressively more transparent pixels for older generations. Add a bit of a hue shift and it renders some really beautiful decay visualizations.
dethstarr大约 13 年前
Good job. I enjoyed looking at the output from an artistic point of view.
wsbail29大约 13 年前
nice implementation! The color adds a lot of visual interest. Here's my monochrome implementation.<p><a href="http://wsb.im/conway/index.html" rel="nofollow">http://wsb.im/conway/index.html</a>
评论 #3876639 未加载