You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why is the new feature important:
Right now all functions are called in the agent scope. The current
code-generation works as:
to go
ask nodes [
function 1 //if function 1 is intended to run at the beginning and already has an "ask nodes". Execution results in an error always.
function 2 //agent-level function
...
function n // agent-level function
]
]
Describe the new feature:
The scope of the fields and functions should be specified by the user:
global_fields: // global fields
- transRange constant 10
- roundLength constant 20
- glowTime constant 5
agent_fields: // agent (local) fields
- mycolor 0
- clock random[1 20]
agent_action_primitives:
- setClock(glowTime)
agent_returning_primitives:
- countLocal(mycolor 10)
observer_primitives: // or global primitives: should not be enclosed in "ask
nodes"
- begin moveRandomWalk(.1)
- begin updateNetworkGraph(transRange)
- end updateColor(glowTime)
- end incrementAgentsClocks(roundLength)
This results into:
globals [
transRange
roundLength
glowTime
]
breed [nodes node]
nodes-own [
mycolor
clock
]
to setup
set transRange 10
set roundLength 20
set glowTime 5
create-nodes [
set mycolor 0
set clock 1 + random 19
]
end
to go
//handle max tick
begin moveRandomWalk(.1) // observer function call
begin updateNetworkGraph(transRange) // observer function call
ask nodes [ // agent-scope functions - here you play with all possible combinations
setClock(glowTime)
countLocal(mycolor 10)
....
]
end updateColor(glowTime) // observer function call
end incrementAgentsClocks(roundLength) // observer function call
end
Original issue reported on code.google.com by andrei.p...@gmail.com on 12 Dec 2011 at 11:31
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
andrei.p...@gmail.com
on 12 Dec 2011 at 11:31The text was updated successfully, but these errors were encountered: