Tributes demanding from city states

dennisdc

Chieftain
Joined
Aug 4, 2006
Messages
18
What determines whether a city state fear my miltary or not ?

In my recent game playing domination Victory and Building a huge fleet and some land units I finally got Gunbout Diplomacy, and I was looking forward to allying with all the city states.
I then looked at one city state which was located very close to me and I realized that it was not fearing my miltary. It had 100 for my miltary but -110 in base reluctance. I then thought "Ok, I will move one of my units close to its borders", but this did nothing. I then moved the unit inside its borders and still nothing.

How exactly is the scores calculated ? Does it matter whether I have ships or land units ? Does the tech levels or strength matter ?
 
What determines whether a city state fear my miltary or not ?
..............
How exactly is the scores calculated ? Does it matter whether I have ships or land units ? Does the tech levels or strength matter ?

The following algorithim is used to determine a successful bully attempt.

If at the end the score of all factors is POSITIVE then the attempt is successful, if it is negative the score is not successful.

0. Start with a score of (-110)
1. If population is < 4 then CS is MUCH harder to BULLY. (-300)
2. The greater your MILITARY POWER, when ranked against all other Major Civs, the greater your chances to BULLY. (Up to +100)
3. Compare the LOCAL MILITARY STRENGTH of both parties. Units within a range of (MAP WIDTH/10) HEXS of the CS are tallied and their relative powers compared for both the CS and the CIV. The power of the CS City is then thrown into the calculation. Finally a ratio between the two is calculated.
MAJOR CIV LOCAL POWER is > 3 CS LOCAL POWER (+100)
MAJOR CIV LOCAL POWER is > 2 CS LOCAL POWER (+80)
MAJOR CIV LOCAL POWER is > 1.5 CS LOCAL POWER (+60)
MAJOR CIV LOCAL POWER is > 1 CS LOCAL POWER (+40)
MAJOR CIV LOCAL POWER is > 0.5 CS LOCAL POWER (+20)
4. If bullied this CS within 10 turns (-300)
5. If bullied this CS within 20 turns (-40)
6. If current CS influence < FRIENDHSIP_THRESHOLD_CAN_BULLY (Unsure how low this number is, assume its probably when war is declared but do not know). (-300)
7. If the current CS influence of the bullying player is <0 then (1.2 * current influence)
8. If the CS is ALLIED with a MAJOR CIV that is NOT the bullying player (-10)
9. For each PLEDGE OF PROTECTION (-20)
10. CS is a HOSTILE CS (-10)
11. CS is a MILITARISTIC CS (-10)
12. GOLD BULLY is harder then a WORKER BULLY.

This algorithm can be condensed into the following rules of thumb.

USEFULL TIPS FOR BULLYING
0. Bully CS that are > then SIZE 4.
1. Bully NON MILITARISTIC and NON HOSTILE CS
2. Bring many units to bear within (MAP WIDTH/10) radius of the CS.
3. Wait 20 turns between bullying the same CS.
4. Bully CS that have no ALLY.
5. Bully CS that are NOT under ANY PLEDGES OF PROTECTION.
6. Bully CS that you have POSITIVE influence with.
7. Increase your overall MILITARY STRENGTH relative to other MAJOR CIVS.


And as usual so people can determine for themselves if my interpretation of the code is correct, here it is :

CODE FROM : CvMinorCivAI.cpp for BNW codebase.

Code:
// Calculates a basic score for whether the major can bully this minor based on many factors.
// Negative score if bully attempt is a failure, zero or positive if success.
// May be modified after return, if the task is easier or harder (ex. bully a worker vs. bully gold)
int CvMinorCivAI::CalculateBullyMetric(PlayerTypes eBullyPlayer, bool bForUnit, CvString* sTooltipSink)
{
	CvString sFactors = "";
	Localization::String sTemp;

	const int iDefaultScore = -110;
	const int iFailScore = -300;

	CvAssertMsg(GetPlayer()->GetID() != eBullyPlayer, "Minor civ and bully civ not expected to have the same ID!");
	if(GetPlayer()->GetID() == eBullyPlayer) return iFailScore;

	CvAssertMsg(eBullyPlayer >= 0, "eBullyPlayer is expected to be non-negative (invalid Index)");
	CvAssertMsg(eBullyPlayer < MAX_MAJOR_CIVS, "eBullyPlayer is expected to be within maximum bounds (invalid Index)");
	if(eBullyPlayer < 0 || eBullyPlayer >= MAX_MAJOR_CIVS) return iFailScore;

	// Can't bully the dead
	if(!GetPlayer()->isAlive())
		return iFailScore;

	// The score beings negative, and has to be bumped up to positive by the below factors in order for the bullying to be successful
	int iScore = iDefaultScore;
	sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
	sTemp << iDefaultScore;
	sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_BASE_RELUCTANCE";
	sFactors += sTemp.toUTF8();

	if (bForUnit)
	{
		int iUnitScore = -30;
		iScore += iUnitScore;
		sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
		sTemp << iUnitScore;
		sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_UNIT_RELUCTANCE";
		sFactors += sTemp.toUTF8();
	}

	// **************************
	// City-State population
	//
	// -300 ~ -0
	// **************************
	if (bForUnit)
	{
		if (GetPlayer()->getCapitalCity() == NULL || GetPlayer()->getCapitalCity()->getPopulation() < 4)
		{
			int iPopulationScore = iFailScore;
			iScore += iPopulationScore;
			sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
			sTemp << iPopulationScore;
			sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_LOW_POPULATION";
			sFactors += sTemp.toUTF8();
		}
	}
	
	// **************************
	// Global military power ranking of major
	//
	// +0 ~ +100
	// **************************
	CvWeightedVector<PlayerTypes, MAX_MAJOR_CIVS, true> veMilitaryRankings;
	PlayerTypes eMajorLoop;
	int iGlobalMilitaryScore = 0;
	for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
	{
		eMajorLoop = (PlayerTypes) iMajorLoop;
		if(GET_PLAYER(eMajorLoop).isAlive() && !GET_PLAYER(eMajorLoop).isMinorCiv())
		{
			veMilitaryRankings.push_back(eMajorLoop, GET_PLAYER(eMajorLoop).GetMilitaryMight()); // Don't recalculate within a turn, can cause inconsistency
		}
	}
	CvAssertMsg(veMilitaryRankings.size() > 0, "WeightedVector of military might rankings not expected to be size 0");
	veMilitaryRankings.SortItems();
	for(int iRanking = 0; iRanking < veMilitaryRankings.size(); iRanking++)
	{
		if(veMilitaryRankings.GetElement(iRanking) == eBullyPlayer)
		{
			float fRankRatio = (float)(veMilitaryRankings.size() - iRanking) / (float)(veMilitaryRankings.size());
			iGlobalMilitaryScore = (int)(fRankRatio * 100); // A score between 100*(1 / num majors alive) and 100, with the highest rank major getting 100
			iScore += iGlobalMilitaryScore;
			break;
		}
	}
	sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_POSITIVE");
	sTemp << iGlobalMilitaryScore;
	sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_GLOBAL_MILITARY";
	sFactors += sTemp.toUTF8();

	// **************************
	// General military power comparison
	// **************************


	// **************************
	// Local military power comparison
	//
	// +0 ~ +100
	// **************************
	int iComparisonRadius = std::max(GC.getMap().getGridWidth() / 10, 5);
	CvCity* pMinorCapital = GetPlayer()->getCapitalCity();
	if(pMinorCapital == NULL)
		return iFailScore;
	CvPlot* pMinorCapitalPlot = pMinorCapital->plot();
	if(pMinorCapitalPlot == NULL)
		return iFailScore;
	int iMinorCapitalX = pMinorCapitalPlot->getX();
	int iMinorCapitalY = pMinorCapitalPlot->getY();
	int iMinorLocalPower = 0;
	int iBullyLocalPower = 0;
	CvPlot* pLoopPlot;
	IDInfo* pUnitNode;
	CvUnit* pLoopUnit;

	// Include the minor's city power
	iMinorLocalPower += pMinorCapital->GetPower();

	for(int iDX = -iComparisonRadius; iDX <= iComparisonRadius; iDX++)
	{
		for(int iDY = -iComparisonRadius; iDY <= iComparisonRadius; iDY++)
		{
			pLoopPlot = ::plotXYWithRangeCheck(iMinorCapitalX, iMinorCapitalY, iDX, iDY, iComparisonRadius);

			if(pLoopPlot != NULL)
			{
				// If there are Units here, loop through them
				if(pLoopPlot->getNumUnits() > 0)
				{
					pUnitNode = pLoopPlot->headUnitNode();

					while(pUnitNode != NULL)
					{
						pLoopUnit = ::getUnit(*pUnitNode);
						pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);

						// Is a combat unit
						if(pLoopUnit && pLoopUnit->IsCombatUnit())
						{
							if(pLoopUnit->getOwner() == eBullyPlayer)
							{
								iBullyLocalPower += pLoopUnit->GetPower();
							}
							else if(pLoopUnit->getOwner() == GetPlayer()->GetID())
							{
								iMinorLocalPower += pLoopUnit->GetPower();
							}
						}
					}
				}

			}
		}
	}
	float fLocalPowerRatio = (float)iBullyLocalPower / (float)iMinorLocalPower;
	int iLocalPowerScore = 0;
	if(fLocalPowerRatio >= 3.0)
	{
		iLocalPowerScore += 100;
	}
	else if(fLocalPowerRatio >= 2.0)
	{
		iLocalPowerScore += 80;
	}
	else if(fLocalPowerRatio >= 1.5)
	{
		iLocalPowerScore += 60;
	}
	else if(fLocalPowerRatio >= 1.0)
	{
		iLocalPowerScore += 40;
	}
	else if(fLocalPowerRatio >= 0.5)
	{
		iLocalPowerScore += 20;
	}
	iScore += iLocalPowerScore;
	sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_POSITIVE");
	sTemp << iLocalPowerScore;
	sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_MILITARY_PRESENCE";
	sFactors += sTemp.toUTF8();

	// **************************
	// Local military threat from major
	// **************************
	//antonjs: consider: count the number of threatening units (similar to counting threatening barbarians), and/or their power



	// **************************
	// Proximity to major
	// **************************



	// **************************
	// Previous bully attempts
	//
	// -300 ~ -0
	// **************************
	int iLastBullyTurn = GetTurnLastBulliedByMajor(eBullyPlayer);
	if(iLastBullyTurn >= 0)
	{
		if(iLastBullyTurn + 10 >= GC.getGame().getGameTurn())
		{
			int iBulliedVeryRecentlyScore = iFailScore;
			iScore += iBulliedVeryRecentlyScore;
			sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
			sTemp << iBulliedVeryRecentlyScore;
			sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_BULLIED_VERY_RECENTLY";
			sFactors += sTemp.toUTF8();
		}
		else if(iLastBullyTurn + 20 >= GC.getGame().getGameTurn())
		{
			int iBulliedRecentlyScore = -40;
			iScore += iBulliedRecentlyScore;
			sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
			sTemp << iBulliedRecentlyScore;
			sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_BULLIED_RECENTLY";
			sFactors += sTemp.toUTF8();
		}
	}

	// **************************
	// Current influence of major
	//
	// -999 ~ -0
	// **************************
	if(GetEffectiveFriendshipWithMajor(eBullyPlayer) < GC.getFRIENDSHIP_THRESHOLD_CAN_BULLY())
	{
		int iInfluenceScore = iFailScore;
		iScore += iInfluenceScore;
		sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
		sTemp << iInfluenceScore;
		sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_LOW_INFLUENCE";
		sFactors += sTemp.toUTF8();
	}
	/*antonjs: consider: scale based on how low the influence is, like:
	float iNegativeInfluenceMultiplier = 1.2f;
	if (GetFriendshipWithMajor(eBullyPlayer) < 0)
	{
		iScore += (int) (iNegativeInfluenceMultiplier * GetFriendshipWithMajor(eBullyPlayer));
		//antonjs: consider: exponent, like influence^1.1
	}
	*/

	// **************************
	// Diplomatic reputation of major
	// **************************


	// **************************
	// Passive Support from other majors
	//
	// -10 ~ -0
	// **************************
	if(GetAlly() != NO_PLAYER && GetAlly() != eBullyPlayer)
	{
		int iAllyScore = -10;
		iScore += iAllyScore;
		sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
		sTemp << iAllyScore;
		sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_ALLIES";
		sFactors += sTemp.toUTF8();
	}
	//antonjs: todo: fulfilled support quests, esp. gold gift
	//antonjs: todo: friendly support units


	// **************************
	// Pledges of Protection from other majors
	//
	// -20 ~ -0
	// **************************
	//antonjs: consider: don't have PtP be a factor here, only have it factor in major civ diplo reaction
	for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
	{
		int iProtectionScore = 0;
		eMajorLoop = (PlayerTypes) iMajorLoop;
		if(eMajorLoop != eBullyPlayer && IsProtectedByMajor(eMajorLoop))
		{
			iProtectionScore += -20;
			iScore += iProtectionScore;
			sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
			sTemp << iProtectionScore;
			sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_PLEDGES_TO_PROTECT";
			sFactors += sTemp.toUTF8();
			break;
		}
	}

	// **************************
	// Major Civ UA, policies
	// **************************



	// **************************
	// Minor Civ Type
	//
	// -20 ~ -0
	// **************************
	if(GetPersonality() == MINOR_CIV_PERSONALITY_HOSTILE)
	{
		int iHostileScore = -10;
		iScore += iHostileScore;
		sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
		sTemp << iHostileScore;
		sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_HOSTILE";
		sFactors += sTemp.toUTF8();
	}
	if(GetTrait() == MINOR_CIV_TRAIT_MILITARISTIC)
	{
		int iMilitaristicScore = -10;
		iScore += iMilitaristicScore;
		sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
		sTemp << iMilitaristicScore;
		sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_MILITARISTIC";
		sFactors += sTemp.toUTF8();
	}

	if (sTooltipSink != NULL)
	{
		(*sTooltipSink) += sFactors;
	}

	return iScore;
}

Hope this helps :)
 
I had the feeling this is only once, not for each protection. Also: Would my own protection count if I bully them?

@FeiLing

I will do my best to answer your questions.

Q1. No it is for each PLEDGE OF PROTECTION, as can be seen from the code here :

Code:
// **************************
	// Pledges of Protection from other majors
	//
	// -20 ~ -0
	// **************************
	//antonjs: consider: don't have PtP be a factor here, only have it factor in major civ diplo reaction
	for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
	{
		int iProtectionScore = 0;
		eMajorLoop = (PlayerTypes) iMajorLoop;
		if(eMajorLoop != eBullyPlayer && IsProtectedByMajor(eMajorLoop))
		{
			iProtectionScore += -20;
			iScore += iProtectionScore;
			sTemp = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_FACTOR_NEGATIVE");
			sTemp << iProtectionScore;
			sTemp << "TXT_KEY_POP_CSTATE_BULLY_FACTOR_PLEDGES_TO_PROTECT";
			sFactors += sTemp.toUTF8();
			break;
		}
	}

Essentially it loops through all the MAJOR CIVS (the eMajorLoop bit) and adds -20 for each POP. NOTE : A negative score means it makes the BULLY ATTEMPT more difficult, a positive score means it makes it easier.

2. No your POP does not count, as can be seen from this incomplete line of code :

Code:
if(eMajorLoop != eBullyPlayer

The code is essentially testing if the current player (eMajorLoop) that is the focus of the iteration, is actually the player attempting to BULLY (ie eBullyPlayer). If it is not then it checks for a POP (see the full code above), and then subtracts 20.

NOTE : -20 is not a huge amount and can be compensate for relatively easily, however multiple POPS do add up, so a strong military is a good idea (both global and local).

Hope this helps.
 
Thx for the info

2. The greater your MILITARY POWER, when ranked against all other Major Civs, the greater your chances to BULLY. (Up to +100)

If I understand the code correctly, I should get 100 for being the number 1 military power ? That is definately not the case in my game. I had the survey done very recently where I was the no. 1 military power by a factor of 4-5 compared to no. 2. Am I reading the code wrongly ?
 
Thx for the info

If I understand the code correctly, I should get 100 for being the number 1 military power ? That is definately not the case in my game. I had the survey done very recently where I was the no. 1 military power by a factor of 4-5 compared to no. 2. Am I reading the code wrongly ?

The 100, is points not gold.

If you have a re-read of the post, at the top somewhere it mentions that the code goes through and add up all of the factors ascribing a POSITIVE or NEGATIVE value to each one. If the end result is POSITIVE then the attempt is successful. How much you get is an entirely different calculation.

For Example.

Right now suppose we are trying to BULLY a POP 6 CS with 1 ALLY (not us) and 3 POP and it is a HOSTILE CS. Suppose we have sufficient troops near their city to overpower them 2 to 1, and suppose we are number 1 in terms of MILITARY STRENGTH worldwide. Finally suppose we bullied them only 15 turns ago and have positive influence with them.

STEP 0. The code starts with a base amount of -110
STEP 1. Does not apply as CS POP is > 4.
STEP 2. We are number one so +100
STEP 3. Our local strength is 2:1 so +80
STEP 4. Does not apply as we did not bully in the last 10 turns.
STEP 5. Applies -40
STEP 6. Does not apply as we have positive influence.
STEP 7. Does not apply as we have positive influence.
STEP 8. Applies as they have an ally -10
STEP 9. Applies, 3 POP so -60
STEP 10. Applies as they are hostile -10
STEP 11. Does not apply as they are not MILITARISTIC.

OK so now we add up the results.

-110
+100
+80
-40
-10
-60
-10
= -50

RESULT - FAILURE

So even here with the #1 power in the world and many units nearby we fail. Because of all the modifiers they have. They have ALLIES, they have POP, they are hostile (and hence less prone to giving in etc).

Now lets remove the POP they have (ie 3*-20) and the result would become +10 which would mean success.

Hope this helps.

NOTE : Be careful in assuming you are the number 1 Civ, the SOLDIERS value in the demographics is not necessarily map 1-1 with the MILITARY STRENTGH calculation. I will have a look at that one day, but for now I would not assume being #1 in SOLDIERS means you are #1 in terms of MILITARY STRENGTH (In terms of how the games AI sees it). ALso in terms of the surveys every 25 turns, I am not sure how they are calculated and may just be rehashing the SOLDIERS value (I can't remember off the top of my head), so again that may not mean you are #1. Anyway all things considered, being the #1 military power is not enough to even overpower the initial -110 of the most passive and compliant CS, you need troops nearby to seal the deal.
 
Thx for the info



If I understand the code correctly, I should get 100 for being the number 1 military power ? That is definately not the case in my game. I had the survey done very recently where I was the no. 1 military power by a factor of 4-5 compared to no. 2. Am I reading the code wrongly ?

You said that your level was at 100 while the against was -110. That seems to imply to me that YOU WERE getting the bonus for largest military, but nothing else.
 
You said that your level was at 100 while the against was -110. That seems to imply to me that YOU WERE getting the bonus for largest military, but nothing else.

Agreed, without the LOCAL POWER BONUS, BULLY attempts will always fail. Sometimes you can fluke it by having a unit within the radius (especially on larger maps) or having the CS near your own cities, but otherwise your need units on their borders.
 
You said that your level was at 100 while the against was -110. That seems to imply to me that YOU WERE getting the bonus for largest military, but nothing else.

Ah, yes of course :D I don't know what I was thinking..

So the only thing I can do to throw the balance in my direction is to have the no. 1 military and place powerful units close to its borders. That would explain why my attempt to use a single privateer and frigate would fail while using an ironclad would succeed. The ironclad has a lot higher strength.

One more question: What is the range of which these units should be from the city-state to be close enough to add to the proximity bonus ? I am currently playing on marathon on a huge map, but I don't quite understand the formula for the distance: (MAP WIDTH/10)
 
Ah, yes of course :D I don't know what I was thinking..

So the only thing I can do to throw the balance in my direction is to have the no. 1 military and place powerful units close to its borders. That would explain why my attempt to use a single privateer and frigate would fail while using an ironclad would succeed. The ironclad has a lot higher strength.

One more question: What is the range of which these units should be from the city-state to be close enough to add to the proximity bonus ? I am currently playing on marathon on a huge map, but I don't quite understand the formula for the distance: (MAP WIDTH/10)

No problem.

MAP WIDTH is the WIDTH of the current MAP SIZE you are using. I cannot remember the MAP WIDTHS off hand, but a forums search should provide them.

In other words the number of HEXS the current game MAP is wide (ie left to right).

OK here is a link to something I apparently wrote a few years ago (don't remember doing it but whatever :) ).

http://forums.steampowered.com/forums/showthread.php?t=1580535

It provides the MAP SIZES you need, as well as some other info you might find usefull.

NOTE : This was from VANILLA Civ V. The MAP sizes have not changed but some of the other stuff may have altered a bit.

So anyway a STANDARD SIZED map is 80 HEXs across.

So MAP_WIDTH/10 = 8 HEXS.

IIRC this is a radius, not a diameter, but if you have issues try using it as a diameter.

So now count out from the city square of the CS 8 HEXS in all directions.

That should help you out.

FYI I have not looked at exactly how the AI calculates unit POWER, to be conservative you can assume HP (of the unit) and CS (of the unit) should definitely apply RCS on the other hand may not. Promotions may not matter (and probably don't). Air Units (ie in a carrier or close city) may not count and naval units could possibly count for less. This is all supposition but in the interests of not misleading you I want my advice to be as conservative as possible.

Just remember the most you can ever get (in points) is 180. So take away the default of 110, will leave you with 70 to account for ALLIES, POP and HOSTILE/MILITARISTIC issues. A HOSTILE/MILITARISTIC CS with an ALLY and 3 POPS will never be able to be bullied (unless worker bullying reduces this). Any CS with 4 POPS (regardless of ALLY status) will never be able to be bullied (again with the caveat with regard to worker bullying).

This is just another area where players who add 22 Civs to the game will find the game mechanics becoming unbalanced (just as it does with IDEOLOGIES, GS Choice and many other areas).

Hope that helps :)
 
@FeiLing
...
Q1. No it is for each PLEDGE OF PROTECTION, as can be seen from the code here :
...
Essentially it loops through all the MAJOR CIVS (the eMajorLoop bit) and adds -20 for each...
It is only once, not for every pledge. In the code the "break" statement inside the if statement will exit from the for loop.

Everything else presented in this thread is spot on though.
 
Top Bottom