Rik's Treehouse
>
Babbling in Binary
>
My Software
>
Orphanware
>
R2DToo
>
R2DToo Help
>
For the Programmer
> shuffleAgents
shuffleAgents
Declaration
Remarks
Example
See Also
Declaration
void __stdcall shuffleAgents(void);
Remarks
This function is available through the API. It is meant to be called from within
onTick
to shuffle the order agents are processed with
forEachAgent
and
forEachAgentVar
.
Example
bool update(
pState
state,
pState
*nbr, int nbrCount, int feaMode) // Called by timestep. { if (feaMode!=feaContinue) return true; int aliveNbrs = 0; for (int i=0; i<nbrCount; i++) alibveNbrs += nbr[i][0]; // Conway's game of Life rule if (aliveNbrs == 3) state[0] = 1; else if (aliveNbrs != 2) state[0] = 0; // else no change (count==2) return true; } void __stdcall onTick(double &time) { // random sequential updating shuffleAgents(); forEachAgent(update); }
See Also
onTick
,
forEachAgent
,
forEachAgentVar
.
[Rik's Office Hours]
[Contact Rik]
Last updated: Fri Apr 30 2004, 1:45pm