Some tips about debugging a model

If you are working with concurrent processes - test it first with one agent before you go to the multi-agent case, think about timing/sychronization.

Collect more information with your agents for debugging: Do not use just numbers to indicate whats going on, but give the agents more information about who offerd to give a ressource, who actually gave a ressource. Add new variables containing information. etc. (e.g. with the primitive GetCurrentSimObject you always get the currently active agent, use Block to execute more than one action in a condition.

Use techniques like Print(Append<String>...) to or the logging feature from the LibraryOfUserFeatures to print out information ... e.g. who is selected, what flags the agent had and what the status of its variables is... When the agent executes that primitive, it write the string to the console (Debug Menu in the menubar -> Console...).

Switch on the debugger and set breakpoints before appropriate actions. Setting breakpoints is like adding a primitive action to an agents behavior program (will not work when set in the world). Then click on Debug -> Debugger. When you now start a simulation run, you will get another run window displaying more information and a stepper ...