public class Communist extends SmartAgentBase
Constructor and Description |
---|
Communist() |
Modifier and Type | Method and Description |
---|---|
void |
attackPhase()
The attackPhase method is called at the start of the agent's attack-phase (duh).
|
java.lang.String |
description()
A description of your agent.
|
void |
fortifyPhase()
The last phase of the turn is for fortifying your armies into neighboring countries.
|
int |
moveArmiesIn(int countryCodeAttacker,
int countryCodeDefender)
Whenever you take over a country, this method will be called by Lux.
|
java.lang.String |
name()
This is the name of your agent.
|
int |
pickCountry()
If the game's preferences are set to allow players to select the initial countries, then the pickCountry() method will be called repeatadly at the beginning of a game, until all the countries have been assigned.
|
void |
placeArmies(int numberOfArmies)
Every turn, each agent gets some armies to place on its countries.
|
float |
version()
The version of your agent.
|
java.lang.String |
youWon()
If your agent wins the game then this method will be called.
|
cardsPhase, cashCardsIfPossible, debug, message, placeInitialArmies, setPrefs
public void attackPhase()
LuxAgent
They have slightly different parameters, but you always provide
1. The country where you are attacking from (a country you own with at least 2 armies),
2. The country where you are attacking to (an enemy country that can be reached from
where you are attacking from),
3. The number of dice you want to attack with (1, 2, or 3 - and you must have at least (dice+1)
armies in the country you are attacking from).
4. Whether you want to repeat the attack until someone wins or not (a false value means just
one dice roll, a true value means keep attacking till someone is wiped out).
The Board's attack() method returns symbolic ints, as follows:
- a negative return means that you supplied incorrect parameters.
- 0 means that your single attack call has finished, with no one being totally defeated. Armies may have been lost from either country.
- 7 means that the attacker has taken over the defender's country.
NOTE: before returning 7, board will call moveArmiesIn() to poll you on how many armies to move into the taken over country.
- 13 means that the defender has fought off the attacker (the attacking country has only 1 army left).
attackPhase
in interface LuxAgent
attackPhase
in class SmartAgentBase
public java.lang.String description()
LuxAgent
public void fortifyPhase()
LuxAgent
Each Country has a moveableArmies variable. Right before the board calls your fortifyPhase method, it will set each Country's moveableArmies equal to that Country's number of armies. Every time you fortify from a country the movableArmies will be decremented, to a minimum of 0.
Within this method you should invoke
board.fortifyArmies( int numberOfArmies, int countryCodeOrigin, int countryCodeDestination);
to do the actual moving.
fortifyPhase
in interface LuxAgent
fortifyPhase
in class SmartAgentBase
public int moveArmiesIn(int countryCodeAttacker, int countryCodeDefender)
LuxAgent
The minimum acceptable answer is the number of attack dice you used.
The maximum acceptable value is the number of armies left in the attacking country minus one.
If you answer outside of these bounds it will be rounded to the nearest.
moveArmiesIn
in interface LuxAgent
moveArmiesIn
in class SmartAgentBase
public java.lang.String name()
LuxAgent
name
in interface LuxAgent
name
in class SmartAgentBase
public int pickCountry()
LuxAgent
If preferences are set to pick the initial countries randomly, then this method will never be called.
pickCountry
in interface LuxAgent
pickCountry
in class SmartAgentBase
public void placeArmies(int numberOfArmies)
LuxAgent
placeArmies
in interface LuxAgent
placeArmies
in class SmartAgentBase
public float version()
LuxAgent
public java.lang.String youWon()
LuxAgent
If you think that you will win a lot feel free to provide many different answers for variety.
youWon
in interface LuxAgent
youWon
in class SmartAgentBase