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

getNbrY

Declaration
Parameters
Return Value
Remarks
Revisions
Example
See Also

Declaration

int __stdcall getNbrY(
	int x,      	// x-coordinate of agent
	int y,      	// y-coordinate of agent
	int nbrIndex  	// index of neighbour to get coordinates of
);
Top of page

Parameters

x
X-coordinate of an agent.
y
Y-coordinate of an agent.
nbrIndex
Neighbour index of agent at (x,y) to return coordinates for.
Top of page

Return Value

Returns the y-coordinate of the specified neighbour of the agent at (x,y). On error returns -1. Top of page

Remarks

This function is available through the API. It can be used, with
getNbrX, to get the coordinates of a neighbour to a specific site. Top of page

Revisions

v1.1
  • new
Top of page

Example

void __stdcall onTick(double &time) { int ax,ay; int **nbr, nbrCount; int *a = anyAgent(NULL,ax,ay,nbr,nbrCount); // pick a neighbour int nbrIndex = random(aNbrCount); // 0..aNbrCount-1 // get second neighbour int bx = getNbrX(ax,ay,nbrIndex); int by = getNbrY(ax,ay,nbrIndex); int *b = xyAgent(bx,by,nbr,nbrCount); // now nbr[0..nbrCount-1] are second neighbours of a. // process second neighbours... }
Top of page

See Also

getNbrX, anyAgent, xyAgent, onTick.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:38pm