Libraries‎ > ‎Sugarscape Library‎ > ‎

Prefer patch with more sugar

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:

Begin description:

Determine which of two patches has the most sugar.

End description

Prefer patch with more sugar

Begin NetLogo code:

to-report preferred-patch [patch-1 patch-2]   report [sugar-of-patch] of patch-1 > [sugar-of-patch] of patch-2end

End NetLogo code

How this works

This compares the amount of sugar of two patches.

Related micro-behaviours

Prefer patch with greater sugar pollution ratio compares not just the sugar levels but the pollution levels as well.

History

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

BehaviourComposer: ignore everything after this.