The ranking of the order that the agent calls the procedure?

I have 5 procedures that I would like to execute for the agent, but I need them to randomize the order of their execution.

For instance:

1) possible ordering

 ask turtles [ move eat breed search spawn]

2) another possible ordering

     ask turtles [spawn eat move search breed]

3) another possible ordering:

ask turtles [search breed eat move spawn]

etc. Is there an efficient way to execute procedures in random order?

+4
source share
1 answer

You can make a list of tasks, shuffle the list, and then run each task in the list:

let procedures (list (task spawn) (task eat) (task move) (task search) (task breed))
ask turtles [foreach shuffle procedures [run ?]]
+5
source

All Articles