- Inherits From:
- ICPlayer
- Declared In:
- ICComputerPlayer.h
Turning in cardsPlacing armies
- - turnInCardsIfPossible
Attacking
- - allocateArmiesRandomly
- - allocateArmiesToMostThreatenedCountries
- - allocateArmiesRandomlyToMostThreatenedCountries
- - allocateArmiesToAttackers
Defending
- - attackVulnerableCountries
- - attackRandomCountries
- - attackVictimsWithAttackers
- - pickAttackersAndVictims
- - calculateAttackPaths
- - attackers
- - setAttackers:
- - victims
- - setVictims:
- - armiesToReserveForDefense
- - fortifyVulnerableCountries
- - updateReserveArmies
- (void)allocateArmiesRandomly
Randomly places armies in the destination countries.
- (void)allocateArmiesRandomlyToMostThreatenedCountries
Same as allocateArmiesToMostThreatenedCountries, except distributes armies a little more evenly and less predictably. Specifically, most armies are placed in the most threatened few countries, while a few armies are randomly distributed among the other countries.
- (void)allocateArmiesToAttackers
For each victim country, while there are unallocated armies, places enough armies in the country that will be used to attack the victim to have a good chance of counquering the victim.
- (void)allocateArmiesToMostThreatenedCountries
Places armies in the most threatened destination countries. While there are unallocated armies, places an army in the most threatened country. The threat level is defined as the number of adjacent enemy armies minus the number of armies.
- (float)armiesToReserveForDefense
The portion of armies to reserve for defense. If this method returns 0.0, all armies will be used for attacking. If it returns 1.0, no armies will be used for attacking.
- (BOOL)attackRandomCountries
Tells each of the player's countries to randomly attack their neighbors. Returns NO
if the player conquers a country. Returns YES
if there are not enough armies to continue attacking.
- (BOOL)attackVictimsWithAttackers
Tries to attack each country in the victims array.
- (BOOL)attackVulnerableCountries
Tells each of the player's countries to attack their most vulnerable neighbors. Returns NO
if the player conquers a country. Returns YES
if there are not enough armies to continue attacking.
- (NSMutableArray *)attackers
The countries you would like to attack from.
- (void)calculateAttackPaths
Calculates attack paths for all countries. After calling this method, every unowned country will have its attackPath array set to the countries along the optimum attack path from an owned country.
- (void)fortifyVulnerableCountries
Sends the fortifyArmiesFrom: message to all countries with armies that can be moved.
- (void)pickAttackersAndVictims
Override this method to pick attackers and victims. You should call this method before placing armies at the beginning of hte turn. It will also be called by attackVictimsWithAttackers if all the victims have been conquered.
- (void)setAttackers:(NSMutableArray *)value
Sets the countries you would like to attack from. You may call this method from your implementation of pickAttackersAndVictims. When attacking using attackVictimsWithAttackers, attacks are actually launched from the first country in each country's attackPath.
- (void)setVictims:(NSMutableArray *)value
Sets the countries you would like to attack. You should call this method from your implementation of pickAttackersAndVictims.
- (void)turnInCardsIfPossible
Checks to see if there are sets of cards that can be turned in. If so, turns them in. This method can be called by assignArmiesFromIncome.
- (void)updateReserveArmies
Sets aside a certain portion of armies in each of the player's countries to use for defense. These armies will not be used when attacking. The portion used for defense is determined by the value returned by armiesToReserveForDefense.
- (NSMutableArray *)victims
The countries you would like to attack. The method attackVictimsWithAttackers will try to attack the countries in victims.