globals [time new-down?]
patches-own [next-pcolor]
to initialize
clear-all
set time 0
set new-down? true
ask patches [
ifelse random 100 < initial-green-density * 100 [set pcolor green][set pcolor black]
set next-pcolor pcolor
]
end
to go-once
if not mouse-down? [set new-down? true]
if new-down? and mouse-down? [
set new-down? false
ask patch (round mouse-xcor) (round mouse-ycor) [set next-pcolor orange]
]
ask patches with [pcolor = orange] [set next-pcolor black]
ask patches with [pcolor = green] [
if count neighbors with [pcolor = orange] > 0 [
if random 100 < transmission-probability * 100 [
set next-pcolor orange]
]
]
ask patches with [pcolor = black] [
if random 100 < regeneration-probability * 100 [set next-pcolor green]
]
ask patches [set pcolor next-pcolor]
end