SimplePlanner¶
- 
public class 
SimplePlannerimplements Serializable¶ An implementation of basic planning methods
Author: Scott, Tim 
Methods¶
getDirections¶
- 
public static LinkedList<Direction> 
getDirections(StateView state, int startingx, int startingy, int endingx, int endingy, int tolerancedistance, boolean cancollideonfinal)¶ Uses A* to calculate the directions to arrive at the specified location. If there is no path, it returns null (it does not do a best effort) When you wish upon A* ...
Parameters: - startingx –
 - startingy –
 - endingx –
 - endingy –
 - tolerancedistance – The distance at which to stop trying to seek (IE, 0 is on top of it, 1 is next to it, etc) Note that the distance should count diagonals as 1 dist
 - cancollideonfinal – Whether or not to allow a collision on the final move (allowing it to be used for gathering by telling it the last direction)
 
Returns: Some primitive (IE, based on directions) moves that bring you within distance of the ending x and y
planAttack¶
- 
public LinkedList<Action> 
planAttack(Unit actor, Unit target)¶ Uses
getDirections(StateView,int,int,int,int,int,boolean)to get directions to the specified place andplanMove(Unit,LinkedList)to follow them. then adds an attack command.Parameters: - actor –
 - target –
 
Returns: A series of actions that move the actor to the target and attacks the target
planAttack¶
- 
public LinkedList<Action> 
planAttack(int actor, int target)¶ 
planBuild¶
- 
public LinkedList<Action> 
planBuild(Unit actor, int targetX, int targetY, UnitTemplate template)¶ 
planBuild¶
- 
public LinkedList<Action> 
planBuild(int actor, int targetX, int targetY, int template)¶ 
planDeposit¶
- 
public LinkedList<Action> 
planDeposit(Unit actor, Unit target)¶ Uses
getDirections(int,int,int,int,int,boolean)to get directions to the specified place andplanMove(Unit,LinkedList)to move almost there. then Then adds the final direction with a gather.Parameters: - actor –
 - target –
 - distance –
 
planDeposit¶
- 
public LinkedList<Action> 
planDeposit(int actor, int target)¶ 
planFail¶
- 
public LinkedList<Action> 
planFail(int actor)¶ 
planGather¶
- 
public LinkedList<Action> 
planGather(Unit actor, ResourceNode target)¶ Uses
getDirections(int,int,int,int,int,boolean)to get directions to the specified place andplanMove(Unit,LinkedList)to move almost there. then Then adds the final direction with a gather.Parameters: - actor –
 - target –
 - distance –
 
Returns: A series of actions that move the actor to the target and gathers from the target
planGather¶
- 
public LinkedList<Action> 
planGather(int actor, int target)¶ 
planMove¶
- 
public LinkedList<Action> 
planMove(Unit actor, int x, int y)¶ Uses
getDirections(int,int,int,int,int,boolean)to get directions to the specified place andplanMove(Unit,LinkedList)to follow them.Parameters: - actor –
 - x –
 - y –
 
planMove¶
- 
public LinkedList<Action> 
planMove(int i, int x, int y)¶ 
planPermanentFail¶
- 
public LinkedList<Action> 
planPermanentFail(int actor)¶ 
planProduce¶
- 
public LinkedList<Action> 
planProduce(int actor, int template)¶