Declaration Parameters Remarks Example See Also
| Declarationvoid __stdcall assignState(
int x, // x-coordinate of agent
int y, // y-coordinate of agent
int index, // state variable index
char *name, // state variable name
tState deflt // default value
);

Parameters
- x
- X-coordinate of agent. Zero-based.
- y
- Y-coordinate of agent. Zero-based.
- index
- Base zero index of agent's state array.
- name
- Name of agent state variable. Used for recording data (eg. time series).
- deflt
- Initial value to assign to state on start of a new simulation.

Remarks
This function is available through the API. It is meant to be used from within the model-provided function initAgent and should be called once for each parameter after calling setStateCount. Note that this function is called for each agent before the neighbours have been defined so no reference to neighbours should be made herein.

Examplevoid __stdcall initAgent(int x, int y, pParam param)
{
setStateCount(x,y, 2); //
// pos index name initial value
assignState(x,y, 0, "alive", flip(param[2]));
assignState(x,y, 1, "alive nbrs", 0);
}

See Also
initAgent, setStateCount, tState.
|