import java.util.* ;
public class RuleTreeGen {
/* Put your state count, neighbor count, and function here */
final static int numStates = 2 ;
final static int numNeighbors = 8 ;
/* order for nine neighbors is nw, ne, sw, se, n, w, e, s, c */
/* order for five neighbors is n, w, e, s, c */
int f(int[] a) {
int n = a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] ;
if (n == 2 && a[8] != 0)
return 1 ;
if (n == 3)
return 1 ;
return 0 ;
}
final static int numParams = numNeighbors + 1 ;
HashMap<String, Integer> world = new HashMap<String, Integer>() ;
ArrayList<String> r = new ArrayList<String>() ;
int[] params = new int[numParams] ;
int nodeSeq = 0 ;
int getNode(String n) {
Integer found = world.get(n) ;
if (found == null) {
found = nodeSeq++ ;
r.add(n) ;
world.put(n, found) ;
}
return found ;
}
int recur(int at) {
if (at == 0)
return f(params) ;
String n = "" + at ;
for (int i=0; i<numStates; i++) {
params[numParams-at] = i ;
n += " " + recur(at-1) ;
}
return getNode(n) ;
}
void writeRuleTree() {
System.out.println("num_states=" + numStates) ;
System.out.println("num_neighbors=" + numNeighbors) ;
System.out.println("num_nodes=" + r.size()) ;
for (int i=0; i<r.size(); i++)
System.out.println(r.get(i)) ;
}
public static void main(String[] args) throws Exception {
RuleTreeGen rtg = new RuleTreeGen() ;
rtg.recur(numParams) ;
rtg.writeRuleTree() ;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
生命游戏 细胞自动机 元胞自动机 Game Of Life (495个子文件)
make-ruletable.cpp 24KB
LifeOnTheSlope.cpp 2KB
LifeOnTheEdge.cpp 2KB
RuleTreeGen.cpp 1KB
Golly.exe 2.98MB
bgolly.exe 388KB
about.gif 47KB
Goucher-replicator.mc.gz 124KB
sphinx-spark.mc.gz 98KB
sphinx-midpoint.mc.gz 86KB
decoder-4bit-demo.rle.gz 81KB
partial-constructor.mc.gz 63KB
sphinx.mc.gz 52KB
metapixel-p216-gun.mc.gz 40KB
metapixel-parity64.mc.gz 34KB
metapixel-galaxy.mc.gz 34KB
hexadecimal.mc.gz 29KB
NP-mutation.rle.gz 19KB
four-primers.rle.gz 16KB
Banks-IV-constructor.rle.gz 12KB
JvN-loop-replicator.rle.gz 11KB
NP-replicator.rle.gz 10KB
golly-constructor.rle.gz 5KB
lex_s.htm 54KB
lex_p.htm 44KB
lex_t.htm 39KB
lex_c.htm 38KB
lex_b.htm 36KB
lex_h.htm 31KB
lex_g.htm 27KB
lex_m.htm 20KB
lex_e.htm 20KB
lex_l.htm 19KB
lex_f.htm 18KB
lex_r.htm 18KB
lex_d.htm 17KB
lex_a.htm 13KB
lex_i.htm 12KB
lex_w.htm 11KB
lex_o.htm 10KB
lex_u.htm 10KB
lex.htm 8KB
lex_q.htm 8KB
lex_n.htm 8KB
lex_j.htm 6KB
lex_k.htm 5KB
lex_v.htm 5KB
lex_1.htm 5KB
lex_bib.htm 4KB
lex_x.htm 3KB
lex_z.htm 3KB
lex_y.htm 3KB
python.html 57KB
perl.html 53KB
formats.html 41KB
changes.html 38KB
License.html 32KB
bounded.html 23KB
RuleLoader.html 13KB
control.html 10KB
file.html 7KB
layer.html 6KB
edit.html 6KB
view.html 6KB
QuickLife.html 6KB
refs.html 4KB
tips.html 4KB
Generations.html 3KB
help.html 3KB
credits.html 3KB
JvN.html 3KB
ReadMe.html 2KB
intro.html 2KB
archives.html 2KB
index.html 1KB
problems.html 1KB
mouse.html 1KB
HashLife.html 667B
about.html 650B
algos.html 589B
RuleTreeGen.java 2KB
breeder.lif 16KB
rabbits.lif 396B
acorn.lif 136B
persian-rugs.lif 74B
primes.mc 80KB
logarithmic-width.mc 24KB
broken-lines.mc 9KB
jagged2.mc 8KB
ruler.mc 5KB
jagged.mc 3KB
totalperiodic.mc 1KB
catacryst.mc 1KB
metacatacryst.mc 1KB
wedge-grow.mc 1KB
mosquito5.mc 1KB
puzzle.mc 814B
unlimited-novelty.mc 731B
gotts-dots.mc 566B
nick-gotts-2.mc 565B
共 495 条
- 1
- 2
- 3
- 4
- 5
资源评论
- 伪装绅士2019-10-10这是一个神奇的游戏。
EricSolshkov
- 粉丝: 2
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 冯璐阳 42105650—祝福.docx
- 基于多种算法及改进算法实现的移动机器人路径规划matlab源码(含A星算法+PRM+RRT的改进等).zip
- 布里斯托尔纸细分市场、总体规模、先进性、市占率行业分析报告2024年.docx
- Obi绳子插件,好用的很 6.5.4版本
- openjfx-22.0.1-windows-x64-bin-sdk.zip
- 基于ros和stm32f1的小车代码(含串口通信)+项目说明.zip
- 人体姿态估计-基于Tensorflow实现的人体姿态估计算法-附项目源码-优质项目分享.zip
- java实现所有算法大全
- JDBC DAO模式 (复习)
- Proteus仿真AT89C51电子密码锁
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功