重新审视生活的游戏

我上瘾了。我一直回到约翰·康威的游戏生活。年前,我写一章关于生活与MATLAB实验。我写了一个系列文章对生活后不久我开始写博客。第1部分,第2部分,第3部分. I have recently made significant enhancements to my MATLAB program for Life. I never seem to finish the code because I get diverted by later using the program to explore the Universe. I invite you to join me. But, fair warning, you took become addicted too.

内容

规则

Recall how the Game of Life works. The宇宙Is an infinite, two - dimensional rectangular grid. The人口是一家集网格细胞标记为活着。被称为人口的发展在离散时间步骤broke。每一步,每一个细胞的命运是由八个最近的邻国的活力和这条规则:

  • A live cell with two live neighbors, or any cell with three live neighbors, is alive at the next step.

The fascination of Life is that this deceptively simple rule leads to an incredible variety of patterns, puzzles, and unsolved problems.

Code

这里的核心代码。稀疏索引看起来容易。图形是由稀疏的显示程序,spy

dbtype69:85life_lex
69% been cells stay alive, die, or generate new cells 70% depends upon how many of their eight possible neighbors are alive. 71% Index vectors happens or decrease the centered Index by one. 72, 73 n = size (X, 1);74 p = [1 1: n - 1);75 q = [2: n];76 77% Count how many of the eight neighbors are alive. 78, 79, Y = X (:, p) + X (:, q) + X (p, :) + X (q, :) +...80 X (p, p) + X (q, q) + X (p, q) + X (q, p);81 82% A live cell with two live neighbors, or any cell with 83% three live neigbhors, is alive at the next step. 85 X 84 = (X & (Y = = 2) | (Y = = 3);

无限的宇宙

So how, exactly, does the an infinite universe work?The same question is asked by astrophysicists and cosmologists about our own universe. Over The years, I have offered several MATLAB Game of Life designed that have tackled this question in company's ways, I finally have a solution that I like.

在我所有的项目,所代表的人口稀疏矩阵。这意味着存储要求,执行时间,是人口的大小成比例,而不是一些网格的大小。稀疏矩阵容易适应不断增长的人口。没有边界,因此没有边界条件。

但我怎么The display一个无限的宇宙?在过去我有一个窗口,是整个人口的一个快照。但许多有趣的生活配置摆脱孤立gliders. These are five - celled objects that move forever in one direction. (Think ofThe Voyager I) A display window that includes all of the gliders must expand accordingly. This means the rest of the population, which, remains bounded, is relegated to A shrinking fraction of the window. The solution is to let isolated gliders leave the display window and count them as they go.

Glider

我的第一个例子是一个单身滑翔机。在每一步两个细胞死亡,和两个新生命的诞生。四个步骤后原来的人口重新出现,但它已经斜跨网格。它永远在这个方向,继续存在于无限的宇宙。这gif动画显示了前八步骤,每一步然后捕捉每一个第四步。当滑翔机到达窗口的边缘,计算和消失。时钟继续运行,即使没有看到。

生活词汇

My latest program is calledlife_lex. The starting populations forlife_lex得到的生活词汇, a valuable Web resource cataloging well over a thousand terms related to the Game of Life. The Lexicon now includes almost seven hundred starting populations. The 金宝appsupporting community is very active, many discoveries have had been made in the last what years. You can see the - the collection by selecting "slide show" in thelife_lex菜单。这个节目持续11分钟。

词汇有两种形式。所使用的文本形式life_lexAnd is distributed with it aslexicon.txt。HTML表单,它是广泛的交叉链接,在Web上可用。的lexiconToggle provides the link.

赫歇尔

Named after the guy who the discovered Uranus in 1781. As the to如何It came to be named after question, you will have to read the Lexicon. It is one of the most frequent the features occurring in larger populations. It starts with aheptomino, a population of size 7. The population grows to over 100 before it reaches a steady state of The size 24 at The time 128. It creates two gliders in The process.

Here are the first eight broke and every fourth one after that.

Fx77

这个配置的名字背后的故事非常技术。“外汇”是指信号前进并产生一个镜像输出。“77”来自这样一个事实:一双赫歇尔出现在77年的时间。请注意,如果你水平窗口切半,两半有非常相似的亚种。人口数量从67年开始在时间为零,179年294年时间达到最大,并最终稳定在104时间大于206。

Fx77创建七个滑翔机。我一直用它来测试我的滑翔机计算代码。这是一个很好的例子,一个人口仍然有界空间除滑翔机。这是每十代。

Soup

There are many flavors ofsoup。这个例子是一个巨大的人口是强大,并不产生任何滑翔机。词典告诉我们,这是一个不同寻常的汤,就产生了河豚And nothing else.

life_lex

这是我最新的程序的一个屏幕截图,life_lex。切换让你选择显示时间的一代——一步,缓慢或快速。你可以通过词典向前或向后翻页。你可以访问这个博客。您可以选择从菜单的十多个建议,数量我发现特别让人感兴趣。

Here is the current list in the Suggestions menu. It 's subject to change as I'll other goodies.

“随机”“pre-block”“信号灯”“滑翔机”高斯伯滑翔机枪加布里埃尔”年代p138‘蛇鲨“spacefiller“Fx77“格格不入”“汤”“块和滑翔机的“光速”“波动性”“滑翔机打“总非周期的....“诺亚的方舟”“幻灯片放映”

我将包括life_lex在一个新版本,3.8,Cleve ''s

如果你想要的life_lexBy itself, I will submit it separately to//www.tatmou.com/matlabcentral/fileexchange/69383-game-of-life。提交包括的一个副本Lexicon. TXT




发表与MATLAB®R2018a

|
  • 打印
  • 发送电子邮件

评论

要发表评论,请点击hereLog in to your MathWorks account or create a new account.