Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. ask limpadores
  2. [ ; check for food
  3. ifelse [pcolor] of patch-here = green
  4. or [pcolor] of patch-ahead 1 = green
  5. or [pcolor] of patch-right-and-ahead 90 1 = green
  6. [
  7. ifelse [pcolor] of patch-here = green [ limpadores-eat ]
  8. [
  9. ifelse [pcolor] of patch-ahead 1 = green [ fd 1 ]
  10. [
  11. if [pcolor] of patch-right-and-ahead 90 1 = green [ rt 90 ]
  12. ]
  13. ]
  14. ]
  15. [ ; check for hazard waste
  16. ifelse [pcolor] of patch-here = yellow
  17. or [pcolor] of patch-ahead 1 = yellow
  18. or [pcolor] of patch-right-and-ahead 90 1 = yellow
  19. and residuos + 1 <= limite-residuos
  20. [ limpadores-look-patch yellow ]
  21. [ ; check for toxic harzard waste
  22. ifelse [pcolor] of patch-here = red
  23. or [pcolor] of patch-ahead 1 = red
  24. or [pcolor] of patch-right-and-ahead 90 1 = red
  25. and residuos + 2 <= limite-residuos
  26. [ limpadores-look-patch red ]
  27. [ ; looking for nest
  28. ifelse [pcolor] of patch-here = blue
  29. or [pcolor] of patch-ahead 1 = blue
  30. or [pcolor] of patch-right-and-ahead 90 1 = blue
  31. and residuos > 0
  32. [
  33. ifelse [pcolor] of patch-here = blue [ limpadores-drop-residuos ]
  34. [
  35. ifelse [pcolor] of patch-ahead 1 = blue [ fd 1 ]
  36. [
  37. if [pcolor] of patch-right-and-ahead 90 1 = blue [ rt 90 ]
  38. ]
  39. ]
  40. ]
  41. [ ; default behaviour
  42. random-movement
  43. ]
  44. ]
  45. ]
  46. ]
  47.  
  48. ; lose one energy, regardless of action
  49. set energia energia - 1
  50. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement