-
Notifications
You must be signed in to change notification settings - Fork 3
/
Bureaucrats-fast.nlogo
197 lines (182 loc) · 1.79 KB
/
Bureaucrats-fast.nlogo
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
globals [total]
patches-own [n]
to benchmark
setup
reset-timer
repeat 5000 [ go ]
output-print timer
end
to setup
clear-all
ask patches [
set n 2
colorize
]
set total 2 * count patches
reset-ticks
end
to go
let active-patches patch-set one-of patches
ask active-patches [
set n n + 1
set total total + 1
colorize
]
while [any? active-patches] [
let overloaded-patches active-patches with [n > 3]
ask overloaded-patches [
set n n - 4
set total total - 4
colorize
ask neighbors4 [
set n n + 1
set total total + 1
colorize
]
]
set active-patches patch-set [neighbors4] of overloaded-patches
]
tick
end
to colorize ;; patch procedure
ifelse n <= 3
[ set pcolor item n [83 54 45 25] ]
[ set pcolor red ]
end
@#$#@#$#@
GRAPHICS-WINDOW
415
10
725
341
-1
-1
3.0
1
10
1
1
1
0
0
0
1
0
99
0
99
1
1
1
ticks
100000.0
BUTTON
10
25
89
58
NIL
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
95
25
173
58
NIL
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
0
PLOT
10
165
400
340
Average
NIL
NIL
0.0
1.0
2.0
2.1
true
true
"" "if not plot? [ stop ]"
PENS
"average" 1.0 0 -16777216 true "" "plotxy ticks (total / count patches)"
SWITCH
40
65
143
98
plot?
plot?
1
1
-1000
BUTTON
10
130
170
163
benchmark (5000 ticks)
benchmark
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
OUTPUT
175
84
400
164
12
@#$#@#$#@
## WHAT IS IT?
This is like Bob's model, but stripped down and speeded up.
Seth Tisue, October 2011
@#$#@#$#@
default
true
0
Polygon -7500403 true true 150 5 40 250 150 205 260 250
@#$#@#$#@
NetLogo 5.0RC2
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
@#$#@#$#@
default
0.0
-0.2 0 1.0 0.0
0.0 1 1.0 0.0
0.2 0 1.0 0.0
link direction
true
0
Line -7500403 true 150 150 90 180
Line -7500403 true 150 150 210 180
@#$#@#$#@
1
@#$#@#$#@