Reputation: 51
I have 2 kinds of mice, a normal and a special. They are eaten by the cats.
Now I want to make the special mice harder to be eaten. So I want it only to be eaten when it is surrounded by at least 2 cats.
Is there a way to check that with a if
or something?
Upvotes: 1
Views: 44
Reputation: 3806
mice-own [is-special]
to step
ask mice
[
let num-surrounding-cats count neighbors4 with [count cats-here > 0]
ifelse is-special
[if num-surrounding-cats > 1 [*eaten logic*]
[ if num-surrounding-cats > 0 [*eaten logic*]]
]
end
Upvotes: 2