Terrarium::Scenario.define do
# create the forest
patches do
with_probability(0.4) { set_color :green }
end
# establish fire spreading behavior
patches! do
if color == :green && neighbors.any? { |e| e.color == :red }
set_color :red
end
end
# start the fire!
random_patch { set_color :red }
end-
-
Save practicingruby/5685285 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
