Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ask limpadores
- [ ; check for food
- ifelse [pcolor] of patch-here = green
- or [pcolor] of patch-ahead 1 = green
- or [pcolor] of patch-right-and-ahead 90 1 = green
- [
- ifelse [pcolor] of patch-here = green [ limpadores-eat ]
- [
- ifelse [pcolor] of patch-ahead 1 = green [ fd 1 ]
- [
- if [pcolor] of patch-right-and-ahead 90 1 = green [ rt 90 ]
- ]
- ]
- ]
- [ ; check for hazard waste
- ifelse [pcolor] of patch-here = yellow
- or [pcolor] of patch-ahead 1 = yellow
- or [pcolor] of patch-right-and-ahead 90 1 = yellow
- and residuos + 1 <= limite-residuos
- [ limpadores-look-patch yellow ]
- [ ; check for toxic harzard waste
- ifelse [pcolor] of patch-here = red
- or [pcolor] of patch-ahead 1 = red
- or [pcolor] of patch-right-and-ahead 90 1 = red
- and residuos + 2 <= limite-residuos
- [ limpadores-look-patch red ]
- [ ; looking for nest
- ifelse [pcolor] of patch-here = blue
- or [pcolor] of patch-ahead 1 = blue
- or [pcolor] of patch-right-and-ahead 90 1 = blue
- and residuos > 0
- [
- ifelse [pcolor] of patch-here = blue [ limpadores-drop-residuos ]
- [
- ifelse [pcolor] of patch-ahead 1 = blue [ fd 1 ]
- [
- if [pcolor] of patch-right-and-ahead 90 1 = blue [ rt 90 ]
- ]
- ]
- ]
- [ ; default behaviour
- random-movement
- ]
- ]
- ]
- ]
- ; lose one energy, regardless of action
- set energia energia - 1
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement