找回密码
 注册
查看: 385|回复: 0

R语言 simecol包 conway()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 02:36:29 | 显示全部楼层 |阅读模式
conway(simecol)
conway()所属R语言包:simecol

                                        The Classical Coway's Game of Life
                                         古典科威的生命游戏

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

simecol example: This model simulates a deterministic cellular automaton.
simecol例如:该模型模拟了一个确定性的元胞自动机。


用法----------Usage----------


data(conway)



格式----------Format----------

An S4 object according to the gridModel specification. The object contains the following slots:
S4的对象根据gridModel规格的。该对象包含以下插槽:




main functions with the state transition rules.
main功能的状态转移规则。




parms A list with two vector elements:
parmsA两个向量元素列表:




srv number of neighbours, necessary to survive,
srv的邻居,为了生存,




gen number of neighbours, necessary to generate a new cell.
gen数量的邻居,必要的,以生成一个新的单元。




times number of time steps to be simulated,
times要模拟的时间步长,




init matrix with the initial state of the cellular
init矩阵与初始状态下的蜂窝


Details

详细信息----------Details----------

To see all details, please have a look into the implementation below.
要查看所有详细信息,请看看下面进入实施。


参考文献----------References----------

Solitaire Game 'Life.' Scientific American, October 1970.

参见----------See Also----------

sim, parms, init, times.
sim,parms,init,times。


实例----------Examples----------


##============================================[#============================================]
## Basic Usage:[#的基本用法:]
##   explore the example[#探索的例子]
##============================================[#============================================]
data(conway)
plot(sim(conway))

## more interesting start conditions[#更有趣的启动条件]
m <- matrix(0, 40, 40)
m[5:35, 19:21] <- 1
init(conway) <- m
plot(sim(conway), col=c("white", "green"), axes = FALSE)

## change survival rules[#改变生存法则。]
parms(conway) <- list(srv = c(3,4), gen = c(3, 4))
plot(sim(conway), col = c("white", "green"), axes = FALSE)
## Not run: [#不运行:]
init(conway) <- matrix(0, 10, 10)
fixInit(conway) # enter some "1"[输入一些“1”]
sim(conway, animate = TRUE, delay = 100)

##============================================[#============================================]
## Implementation:[#实现:]
##   The code of Conways Game of Life[#Conways生命游戏的代码]
##============================================[#============================================]
conway <- new("gridModel",
  main = function(time, init, parms) {
    x      <- init
    nb     <- eightneighbours(x)
    surviv <- (x >  0 &amp; (nb %in% parms$srv))
    gener  <- (x == 0 &amp; (nb %in% parms$gen))
    x      <- (surviv + gener) > 0
    return(x)
  },
  parms  = list(srv = c(2, 3), gen = 3),
  times  = 1:17,
  init   = matrix(round(runif(1000)), ncol = 40),
  solver = "iteration"
)

## End(Not run)[#(不执行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-23 23:11 , Processed in 0.019101 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表