When I'm hungry I try to eat. If my hunger is high and something is nearby then with .75 probability I'll eat it.

Begin micro-behaviour

EAT-WHEN-HUNGRY

Begin NetLogo code:
whenever
  [random-number-between 0 1 <= .75 and my-hunger > 50 and can-pick-one all-individuals with [distance-to-me < 5]]
  [add-behaviour-to the-other DIE  
   add-behaviour-to-me REDUCE-HUNGER]
End NetLogo code

Variants

The level of hunger and the distance to the potential prey can be changed. Other conditions can be used.

Related Micro-behaviours

This relies upon DIE and REDUCE-HUNGER. DIE-WHEN-TOO-HUNGRY is the behaviour for starving if too hungry. GROW-HUNGRY steadily increases hunger.

How this works

Whenever a random number between 0 and 1 turns out to be less than .75 (i.e. 75% of the time) and my-hunger is greater than 50 and anyone is less than 5 units away.

History

This was implemented by Ken Kahn.