netlogo - ask one agent set to get a value from another agent set -


my sellers set trade_price code:

ask buyers  [ ask sellers [if any? buyers-here [ if seller_price <= [buyer_price] of myself         [ set trade_price  seller_price + random ([buyer_price] of myself - seller_price) ]]]]  

i want buyers took same trade_price if have seller in same patch.(if any? sellers-here). , code so:

ask sellers [ ask buyers [if any? sellers-here [set trade_price ( [trade_price] of myself )]]] 

i think wrong code because got different trade_price s agent couples. have idea how can set it? best reagrds

as far can tell, you're trying this:

ask buyers [   let candidate one-of sellers-here   if candidate != nobody [     set trade_price [trade_price] of candidate   ] ] 

note there no ask sellers around this. want each buyer run once each time through go.

note if there multiple sellers on patch, one-of sellers-here picks 1 randomly.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -