toroidwars.player.mpd209
Class RetaliatoryPlayer
java.lang.Object
toroidwars.interfaces.BasePlayer
toroidwars.player.mpd209.RetaliatoryPlayer
- All Implemented Interfaces:
- toroidwars.interfaces.Player
public class RetaliatoryPlayer
- extends toroidwars.interfaces.BasePlayer
Example Retaliatory player, designed to strike back if attacked,
does not hold a grudge though, so it only aplies to the previous turn.
If not attacking it builds, if it can't build it tries to transfer
otherwise it simply passes.
Player is quite stupid as it does not take the turns for it's countries
in a particular order, nor does it try and join up, or change strategies
at any point
Player source was written all in one file to give a clear step through the
methods involved but there is no reason that the methods cannot be moved into
seperate classes for more complicated strategies.
| Fields inherited from class toroidwars.interfaces.BasePlayer |
name |
|
Constructor Summary |
RetaliatoryPlayer(toroidwars.interfaces.Log log)
Constructor for retaliatory player. |
|
Method Summary |
java.lang.String |
getName()
Overidden method to supply my own name |
void |
initialise(toroidwars.interfaces.WorldMap map,
int totalTurns)
|
void |
output(java.lang.String output)
Simple little debug method |
void |
takeTurn(int turn,
toroidwars.interfaces.Country[] countries)
|
void |
turnTimedOut(int turn)
|
| Methods inherited from class toroidwars.interfaces.BasePlayer |
getLog |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RetaliatoryPlayer
public RetaliatoryPlayer(toroidwars.interfaces.Log log)
throws toroidwars.exceptions.PlayerCreationException
- Constructor for retaliatory player.
Required to have a constructor with a Log argument
- Parameters:
log - Passed log
- Throws:
toroidwars.exceptions.PlayerCreationException - thrown if log passed
to super(log) is null.
output
public void output(java.lang.String output)
- Simple little debug method
- Parameters:
output -
getName
public java.lang.String getName()
- Overidden method to supply my own name
- Specified by:
getName in interface toroidwars.interfaces.Player- Overrides:
getName in class toroidwars.interfaces.BasePlayer
- Returns:
- player name
initialise
public void initialise(toroidwars.interfaces.WorldMap map,
int totalTurns)
takeTurn
public void takeTurn(int turn,
toroidwars.interfaces.Country[] countries)
turnTimedOut
public void turnTimedOut(int turn)