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,17 +8,14 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
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 [
11+ if (random 100) < density
12+ [ set pcolor green ]
1813 ;; make a column of burning trees at the left-edge
19- if pxcor = min-pxcor [ set pcolor red ]
14+ if pxcor = min-pxcor
15+ [ set pcolor red ]
2016 ]
21-
17+ ;; keep track of how many trees there are
18+ set initial-trees count patches with [pcolor = green]
2219 reset-ticks
2320end
2421
Original file line number Diff line number Diff line change @@ -8,17 +8,14 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
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 [
11+ if (random 100) < density
12+ [ set pcolor green ]
1813 ;; make a column of burning trees at the left-edge
19- if pxcor = min-pxcor [ set pcolor red ]
14+ if pxcor = min-pxcor
15+ [ set pcolor red ]
2016 ]
21-
17+ ;; keep track of how many trees there are
18+ set initial-trees count patches with [pcolor = green]
2219 reset-ticks
2320end
2421
Original file line number Diff line number Diff line change @@ -8,21 +8,17 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
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 [
11+ if (random 100) < density
12+ [ set pcolor green ]
1813 ;; make a column of burning trees at the left-edge
19- if pxcor = min-pxcor [ set pcolor red ]
14+ if pxcor = min-pxcor
15+ [ set pcolor red ]
2016 ]
21-
17+ ;; keep track of how many trees there are
18+ set initial-trees count patches with [pcolor = green]
2219 reset-ticks
2320end
2421
25-
2622to go
2723 ;; stop the model when done
2824 if all? patches [pcolor != red]
Original file line number Diff line number Diff line change @@ -8,17 +8,16 @@ to setup
88 clear-all
99 ;; make some green trees
1010 ask patches [
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 [
11+ if (random 100) < density [
12+ set pcolor green
13+ ]
1814 ;; make a column of burning trees at the left-edge
19- if pxcor = min-pxcor [ set pcolor red ]
15+ if pxcor = min-pxcor [
16+ set pcolor red
17+ ]
2018 ]
21-
19+ ;; keep track of how many trees there are
20+ set initial-trees count patches with [pcolor = green]
2221 reset-ticks
2322end
2423
4342 <widgets >
4443 <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 >
4544 <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 >
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 >
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 >
4746 <button x =" 106" y =" 96" height =" 40" disableUntilTicks =" true" forever =" true" kind =" Observer" width =" 69" display =" go" >go</button >
4847 <button x =" 26" y =" 96" height =" 40" disableUntilTicks =" false" forever =" false" kind =" Observer" width =" 70" display =" setup" >setup</button >
4948 </widgets >
You can’t perform that action at this time.
0 commit comments