-
Notifications
You must be signed in to change notification settings - Fork 0
/
GandR.ma
125 lines (106 loc) · 8.55 KB
/
GandR.ma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
[Top]
components : GandR
[GandR]
type : cell
dim : (60,60)
delay : transport
defaultDelayTime : 1000
border : wrapped
%neighborhood
neighbors : GandR(-2,0)
neighbors : GandR(-1,-1) GandR(-1,0) GandR(-1,1)
neighbors : GandR(0,-2) GandR(0,-1) GandR(0,0) GandR(0,1) GandR(0,2)
neighbors : GandR(1,-1) GandR(1,0) GandR(1,1)
neighbors : GandR(2,0)
initialvalue : 0
initialCellsValue : GandR.val
localtransition : growth
[growth]
%probability to be colonized by the neighbor (-2,0)
rule : {(-2,0)} 1000 {(0,0) = 0 and (-2,0) > 0 and random < ((0.1/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (-1,-1)
rule : {(-1,-1)} 1000 {(0,0) = 0 and (-1,-1) > 0 and random < ((0.25/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (-1,0)
rule : {(-1,0)} 1000 {(0,0) = 0 and (-1,0) > 0 and random < ((0.4/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (-1,-1)
rule : {(-1,1)} 1000 {(0,0) = 0 and (-1,1) > 0 and random < ((0.25/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (0,-2)
rule : {(0,-2)} 1000 {(0,0) = 0 and (0,-2) > 0 and random < ((0.1/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (0,-1)
rule : {(0,-1)} 1000 {(0,0) = 0 and (0,-1) > 0 and random < ((0.4/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (0,1)
rule : {(0,1)} 1000 {(0,0) = 0 and (0,1) > 0 and random < ((0.4/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (0,2)
rule : {(0,2)} 1000 {(0,0) = 0 and (0,2) > 0 and random < ((0.1/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (1,-1)
rule : {(1,-1)} 1000 {(0,0) = 0 and (1,-1) > 0 and random < ((0.25/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (1,0)
rule : {(1,0)} 1000 {(0,0) = 0 and (1,0) > 0 and random < ((0.4/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (1,1)
rule : {(1,1)} 1000 {(0,0) = 0 and (1,1) > 0 and random < ((0.25/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
%probability to be colonized by the neighbor (2,0)
rule : {(2,0)} 1000 {(0,0) = 0 and (2,0) > 0 and random < ((0.1/( if(((-2,0)>0),0.1,0)+ if(((-1,-1)>0),0.25,0)+ if(((-1,0)>0),0.4,0)
+ if(((-1,1)>0),0.25,0)+ if(((0,-2)>0),0.1,0)+ if(((0,-1)>0),0.4,0)+ if(((0,1)>0),0.4,0)+ if(((0,2)>0),0.1,0)
+ if(((1,-1)>0),0.25,0)+ if(((1,0)>0),0.4,0)+ if(((1,1)>0),0.25,0)+ if(((2,0)>0),0.1,0) )) *(1- ( if(((-2,0)>0),0.9,1)
* if(((-1,-1)>0),0.75,1)* if(((-1,0)>0),0.6,1)* if(((-1,1)>0),0.75,1)* if(((0,-2)>0),0.9,1)* if(((0,-1)>0),0.6,1)
* if(((0,1)>0),0.6,1)* if(((0,2)>0),0.9,1)* if(((1,-1)>0),0.75,1)* if(((1,0)>0),0.6,1)
* if(((1,1)>0),0.75,1)* if(((2,0)>0),0.9,1) ))) }
% 40% chance a ramet dies if overcrowded
rule : {0} 1000 {((0,0) > 0) and (falseCount < 3) and (random < 0.4)}
%otherwise stay the same
rule : {(0,0)} 1000 {t}