move | R Documentation |
The generic function move
implements a random movement in the Moore neighbourhood of an individual.
move(object, pos, n, m, j, occupyM)
## S4 method for signature 'Organism'
move(object, pos, n, m, j, occupyM)
object |
An object of class Organism. |
pos |
A dataframe with all occupied x and y positions |
n |
A number giving the horizontal size of the environment. |
m |
A number giving the vertical size of the environment. |
j |
The number of the iteration of interest. |
occupyM |
A matrix indicating grid cells that are obstacles |
Organisms move in a random position the Moore neighbourhood, which is not occupied by other individuals. If there is no free space the individuals stays in the same position.
Organism-class
, emptyHood
data(Ec_core, envir = environment()) #get Escherichia coli core metabolic model
bac <- Bac(Ec_core,deathrate=0.05,
minweight=0.05,growtype="exponential") #initialize a bacterium
arena <- Arena(n=20,m=20) #initialize the environment
arena <- addOrg(arena,bac,amount=10) #add 10 organisms
arena <- addSubs(arena,40) #add all possible substances
move(bac,n=20,m=20,j=1,pos=arena@orgdat[,c('x','y')], occupyM=arena@occupyM)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.