示例#1
0
int sendMessage(int sender,int receiver,int msg,int TTL)
{
	int enterQueue(struct Message *,int );
	struct Message *nextNode;
	nextNode=(struct Message *)malloc(sizeof(struct Message));
	nextNode->sender=sender;
	nextNode->TTL=TTL;
	nextNode->msg=msg;
	nextNode->next=NULL;
	enterQueue(nextNode,receiver);

	return 0;
}
示例#2
0
int findPathDist(Map g, LocationID start, LocationID end){
    
    assert(g != NULL);
    
    assert(start >= MIN_MAP_LOCATION && start <= MAX_MAP_LOCATION);
    assert(end >= MIN_MAP_LOCATION && end <= MAX_MAP_LOCATION);
    
    int visiting=start;
    int index=0;
    int pathDistance=0;
    
    Queue q=newQueue();
    enterQueue(q,start);
    
    int visited[NUM_MAP_LOCATIONS]={FALSE};
    int priorVisit[NUM_MAP_LOCATIONS]={[0 ... (NUM_MAP_LOCATIONS-1)] = UNKNOWN_LOCATION};