Conway’s Game of Life [生命游戏]

生命游戏其实是一个零玩家游戏(百度百科),这个小游戏是一个简单的二维元包自动机(Cellular Automaton),1970年由英国的数学家 John Horton Conway 提出,关于生命游戏的介绍参考 Wikipedia 的 Conway’s Game of Life

游戏中生命的演化规则(The Law of Life Evolution)

  • 如果原先为活的细胞,其周围活的细胞总数少于2个,则该细胞死去。(Any live cell with fewer than two live neighbours dies, as if caused by under-population).
  • 如果原先为活的细胞,其周围活的细胞总数为2个或者3个,则该细胞保持生命。(Any live cell with two or three live neighbours lives on to the next generation).
  • 如果原先为活的细胞,其周围活的细胞总数大于3个,则该细胞将死去。(Any live cell with more than three live neighbours dies, as if by overcrowding).
  • 如果原先为死的细胞,其周围活的细胞总数刚好为3个,则该细胞将重新获得生命。(Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction).

简单来说就是太拥挤会死,太寂寞会死,给你点阳光你就灿烂!

依据以上规则,编制小游戏,其中初始生命体密度设置为0.1 (Density of Initial Life were 0.1 )



游戏说明(Game Help)

  • 鼠标/空格键 停止或者开始。(Press SPACE BAR / Click Mouse to pause or to begin.)
  • 键盘”R”键 重新随机生成生命。(Press R to randomly reset the state of all the cells.)
  • 红色表示新增加的生命。(Red Cell means the cell is born.)

PS.
很有趣的是,从一开始杂乱无章的状态,经过一段时间后,细胞会达到一种稳定平衡状态。


You already voted!

10 thoughts on “Conway’s Game of Life [生命游戏]

  1. Dyson Reply

    This page contains a Javascript implementation of the well know John Conway’s Game of Life.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.