我正在测试NetLogo,我正在组装两个模型Halo和Fire,我想要做的是当火焰触及乌龟的光环时乌龟逃跑并警告其他乌龟不要去光环区域是。当乌龟没有逃跑它死了,我不知道该怎么做。
breed [runners runner]
breed [halos halo]
globals [ initial-trees ]
to setup
clear-all
set-default-shape halos "thin ring"
create-runners 10
[ setxy random-xcor random-ycor ]
ask runners [ set size 10 ]
ask runners [ set color white ]
ask patches [
if (random 100) < density
[ set pcolor green ]
if pxcor = min-pxcor
[ set pcolor red ]
]
set initial-trees count patches with [pcolor = green]
reset-ticks
end
to go
ask runners [ fd 0.5 ]
walk
if all? patches [ pcolor != red ] [ stop ]
ask patches with [ pcolor = red ] [
ask neighbors with [ pcolor = green ] [
let probability probability-of-spread
let direction towards myself
if random 100 < probability
[ set pcolor red
;if [ pcolor ] of patch xcor ycor = red [ Death ]
]
]
set pcolor red - 3.5
]
tick
end
to make-halo
hatch-halos 1
[ set size 15
set color yellow
__set-line-thickness 1.5
create-link-from myself [ tie hide-link ]
]
end
to walk
ask runners [
rt one-of [-90 0 90]
forward 5
]
tick
end
图形元素
GRAPHICS-WINDOW
286
10
796
521
-1
-1
2.0
1
10
1
1
1
0
0
0
1
-125
125
-125
125
1
1
1
ticks
30.0
BUTTON
3
10
69
43
NIL
setup
NIL
1
T
OBSERVER
NIL
NIL
NIL
NIL
1
BUTTON
4
50
71
83
NIL
go
T
1
T
OBSERVER
NIL
NIL
NIL
NIL
0
SLIDER
7
137
189
170
density
density
0.0
100.0
69.0
1.0
1
%
HORIZONTAL
MONITOR
122
25
220
70
percent burned
((count patches with [shade-of? pcolor red]) / initial-trees)\n* 100
1
1
11
SLIDER
6
182
188
215
probability-of-spread
probability-of-spread
0
100
50.0
1
1
%
HORIZONTAL