Learning Go by coding Conway's Game of Life

xuanbao · · 1583 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello,</p> <p>I&#39;m looking for better tools to work with concurrent programming and seens GO fits well. To do so I coded Conway&#39;s Game of Life algorithm with Go. I would love if you could waste some time criticizing and giving opinions on the code wrote.</p> <p>Check my code here: <a href="https://github.com/luizdepra/game-of-learn/tree/master/go">https://github.com/luizdepra/game-of-learn/tree/master/go</a></p> <p>So far I know I not seeding rand function, and I must to so. And I can do more error handling. You guys see any another improvements?</p> <p>Ty.</p> <hr/>**评论:**<br/><br/>bbrazil: <pre><p>I&#39;ve implemented <a href="http://demo.robustperception.io:9090/consoles/life.html" rel="nofollow">Conway&#39;s Game of Life</a> in a language that&#39;s implemented in Go. Not having a good source of randomness leads to odd patterns.</p></pre>dasacc22: <pre><p>Overall, looks nice. I did something similar when first learning Go as well. <a href="https://github.com/dskinner/cell" rel="nofollow">https://github.com/dskinner/cell</a></p> <p>Given the similarities in game-of-life and some rules from wolfram&#39;s a new kind of science, i used that as an opportunity to play with Go interfaces at the time. You can check that out here: <a href="https://github.com/dskinner/cell/tree/master/automata" rel="nofollow">https://github.com/dskinner/cell/tree/master/automata</a></p> <p>You may want to consider supporting custom rules just for fun. Also, i never got around to it but I did want to be able to save/load preset cell start positions. Don&#39;t know if it still works but the opengl output of mine allowed pause/resume with spacebar, draw/erase with mouse, and zoom with mousewheel. For game of life, that allowed creating some of the more interesting structures which was fun.</p> <p>You may also want to write some benchmarks (and thus learn about testing in Go) so you can establish an upper bound of what your implementation can support just for documentation (and then learn about go doc).</p> <p>Lots of ways to have fun here and improve.</p></pre>RawArkanis: <pre><p>Sure, I&#39;ll code presets. Nice idea. Tests and debuging are my next stop too.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1583 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传