Beispiel #1
0
void invigorate(BinaryHeap<soldier>& heap, vector<int>& soldiers, int remaining_Soldiers)
//Stepping through all remaining soldiers, we randomly subtract a small value to allow them to act faster.
{
	int currentSoldier, delta;

	if(remaining_Soldiers == 0){//We cannot invigorate an array of dead soldiers. 
		 return;
	}
	
	for(int i = 0; i < remaining_Soldiers; i++)
	{
		soldier current = heap.find_by_ID(i);

		currentSoldier = soldiers[i];
		delta = (rand() % 2 + 1);//determine a random amount to decrease by
		heap.decrease_by_iD(currentSoldier, delta);//Manipulate our current heap so that spartans act a little quicker.
		
	}

}