Libraries‎ > ‎Sugarscape Library‎ > ‎

Prefer more sugar to pollution ratio

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:

Begin description:

Determine which of two patches has the most sugar to pollution ratio.

End description

Prefer patch with greater
sugar pollution ratio

Begin NetLogo code:

to-report preferred-patch [patch-1 patch-2]
   report ([sugar-of-patch] of patch-1 / (1 + [pollution-of-patch] of patch-1) >
           [sugar-of-patch] of patch-2 / (1 + [pollution-of-patch] of patch-2))
end

End NetLogo code

How this works

This computes the ratio of sugar to pollution of each patch and compares them.

Related micro-behaviours

Prefer patch with more sugar ignores pollution in comparing two patches.

History

This was created and last updated by Ken Kahn on 29 June 2012.

BehaviourComposer: ignore everything after this.

Comments