File tree Expand file tree Collapse file tree
IABM Textbook/chapter 3/Fire Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,14 +8,17 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
11- if (random 100) < density
12- [ set pcolor green ]
11+ if (random 100) < density [ set pcolor green ]
12+ ]
13+
14+ ;; Count initial trees before lighting trees on fire to get accurate calculation of percent burned
15+ set initial-trees count patches with [pcolor = green]
16+
17+ ask patches [
1318 ;; make a column of burning trees at the left-edge
14- if pxcor = min-pxcor
15- [ set pcolor red ]
16- ]
17- ;; keep track of how many trees there are
18- set initial-trees count patches with [pcolor = green]
19+ if pxcor = min-pxcor [ set pcolor red ]
20+ ]
21+
1922 reset-ticks
2023end
2124
Original file line number Diff line number Diff line change @@ -8,14 +8,17 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
11- if (random 100) < density
12- [ set pcolor green ]
11+ if (random 100) < density [ set pcolor green ]
12+ ]
13+
14+ ;; Count initial trees before lighting trees on fire to get accurate calculation of percent burned
15+ set initial-trees count patches with [pcolor = green]
16+
17+ ask patches [
1318 ;; make a column of burning trees at the left-edge
14- if pxcor = min-pxcor
15- [ set pcolor red ]
16- ]
17- ;; keep track of how many trees there are
18- set initial-trees count patches with [pcolor = green]
19+ if pxcor = min-pxcor [ set pcolor red ]
20+ ]
21+
1922 reset-ticks
2023end
2124
Original file line number Diff line number Diff line change @@ -8,17 +8,21 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
11- if (random 100) < density
12- [ set pcolor green ]
11+ if (random 100) < density [ set pcolor green ]
12+ ]
13+
14+ ;; Count initial trees before lighting trees on fire to get accurate calculation of percent burned
15+ set initial-trees count patches with [pcolor = green]
16+
17+ ask patches [
1318 ;; make a column of burning trees at the left-edge
14- if pxcor = min-pxcor
15- [ set pcolor red ]
16- ]
17- ;; keep track of how many trees there are
18- set initial-trees count patches with [pcolor = green]
19+ if pxcor = min-pxcor [ set pcolor red ]
20+ ]
21+
1922 reset-ticks
2023end
2124
25+
2226to go
2327 ;; stop the model when done
2428 if all? patches [pcolor != red]
Original file line number Diff line number Diff line change @@ -8,16 +8,17 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
11- if (random 100) < density [
12- set pcolor green
13- ]
11+ if (random 100) < density [ set pcolor green ]
12+ ]
13+
14+ ;; Count initial trees before lighting trees on fire to get accurate calculation of percent burned
15+ set initial-trees count patches with [pcolor = green]
16+
17+ ask patches [
1418 ;; make a column of burning trees at the left-edge
15- if pxcor = min-pxcor [
16- set pcolor red
17- ]
18- ]
19- ;; keep track of how many trees there are
20- set initial-trees count patches with [pcolor = green]
19+ if pxcor = min-pxcor [ set pcolor red ]
20+ ]
21+
2122 reset-ticks
2223end
2324
4243 <widgets >
4344 <view x =" 200" wrappingAllowedX =" false" y =" 10" frameRate =" 30.0" minPycor =" -125" height =" 506" showTickCounter =" true" patchSize =" 2.0" fontSize =" 10" wrappingAllowedY =" false" width =" 506" tickCounterLabel =" ticks" maxPycor =" 125" updateMode =" 1" maxPxcor =" 125" minPxcor =" -125" ></view >
4445 <monitor x =" 43" precision =" 1" y =" 152" height =" 60" fontSize =" 11" width =" 115" display =" percent burned" >(count patches with [shade-of? pcolor red]) / initial-trees * 100</monitor >
45- <slider x =" 5" step =" 1.0" y =" 38" max =" 99.0" width =" 185" display =" density" height =" 50" min =" 0.0" direction =" Horizontal" default =" 57 .0" variable =" density" units =" %" ></slider >
46+ <slider x =" 5" step =" 1.0" y =" 38" max =" 99.0" width =" 185" display =" density" height =" 50" min =" 0.0" direction =" Horizontal" default =" 99 .0" variable =" density" units =" %" ></slider >
4647 <button x =" 106" y =" 96" height =" 40" disableUntilTicks =" true" forever =" true" kind =" Observer" width =" 69" display =" go" >go</button >
4748 <button x =" 26" y =" 96" height =" 40" disableUntilTicks =" false" forever =" false" kind =" Observer" width =" 70" display =" setup" >setup</button >
4849 </widgets >
You can’t perform that action at this time.
0 commit comments