I am currently working on a project that requires the following: I want the port (a breed) to ask storage locations (another breed) whether they have a certain value. If not, that proceed to ask the next storage location etc. etc. until he finds that location with the correct value. If so, than it should take another action (like building something). I got this now, which seems to work but it is super long and over complicated I think.
to check-pipeline-26
ask storage 26
[ifelse pipeline < 1
[build-pipeline]
[check-pipeline-27]
]
end
to check-pipeline-27
ask storage 27
[ifelse pipeline < 1
[build-pipeline]
[check-pipeline-28]
]
end
to check-pipeline-28
ask storage 28
[ifelse pipeline < 1
[build-pipeline]
[check-pipeline-29]
]
end
to check-pipeline-29
ask storage 29
[ifelse pipeline < 1
[build-pipeline]
[check-pipeline-30]
]
end
Let me know if you have any tips to make this easier or simplified. Thanks in advance!
Max
Aucun commentaire:
Enregistrer un commentaire