A simple and naïve Game of Life pattern searcher written in Wolfram Language.
这是个用来搜索生命游戏(以及别的 Life-like 的元胞自动机)里的图样的 Mathematica 包。搜索方式是把图样要满足的条件看成一个 SAT 问题,然后用 Mathematica 自带的 SatisfiabilityInstances
函数求解。灵感来自 Oscar Cunningham 写的 Logic Life Search。
这个包就是写着玩的,搜索速度慢得离谱,完全无法搜索周期稍大的图样。如果需要实用一点的搜索工具,推荐使用 Logic Life Search(可搜各种图样),或者 ntzfind(专搜飞船)。更多搜索工具见《生命游戏搜索程序汇总》。
我不怎么懂编程,代码肯定有很多 bug。遇到问题欢迎来提 issue。
以下是简短的英文说明。详细的用法见维基(仅中文),或者使用范例。
This is a Mathematica package for finding patterns in life-like cellular automata. Inspired by Oscar Cunningham's Logic Life Search, it converts the problem to a SAT problem, and solves it with the built-in function SatisfiabilityInstances
.
This is a Mathematica package, so you need Wolfram Mathematica. Here is a installation guide for any Mathemaica packages.
After the installation, you can load the package with
<< Life`
The main function in the package is LifeFind
. LifeFind[x, y, p, dx, dy]
will try to find a pattern with size (x,y)
, period p
(default = 1
), and translating (dx,dy)
(default = (0,0)
) during a period.
For example, this may find 25P3H1V0.1:
LifeFind[5, 16, 3, 1, 0]
You can specify the rule and the symmetry with options "Rule"
and "Symmetry"
(see the screenshot above). The default rule is "B3/S23"
(Conway's Game of Life). The supported symmetries are the same as Logic Life Search.
If you can read Chinese, please read the Wiki or these usage examples.
- Totalistic and non-totalistic life-like rules
- Totalistic and non-totalistic hexagonal rules (hexagonal symmetries are not supported)
- The corresponding Generations rules.
The output for Generations rules might be incomplete: there might be "dying" cells outside the bounding box. I will not fix this.
If "Rule"
is set to ""
, it will search in an unspecified rule, and return both the rule and the pattern. This is extremely slow, and the rule string is not simplified.