Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > assignState

assignState

Declaration
Parameters
Remarks
Example
See Also

Declaration

void __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
);
Top of page

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.
Top of page

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. Top of page

Example

void __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); } Top of page

See Also

initAgent, setStateCount, tState.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 2:36pm