soc.robot
Class SOCPossibleSettlement

java.lang.Object
  extended by soc.robot.SOCPossiblePiece
      extended by soc.robot.SOCPossibleSettlement

public class SOCPossibleSettlement
extends SOCPossiblePiece

This is a possible settlement that we can build

Author:
Robert S Thomas

Field Summary
protected  java.util.Vector<SOCPossibleSettlement> conflicts
           
protected  java.util.Vector<SOCPossibleRoad> necessaryRoads
           
protected  int numberOfNecessaryRoads
           
protected  java.util.Stack<SOCPossibleRoad> roadPath
           
protected  int[] speedup
          Speedup per building type.
 
Fields inherited from class soc.robot.SOCPossiblePiece
biggestThreats, CARD, CITY, coord, eta, hasBeenExpanded, MAXPLUSONE, MIN, PICK_SPECIAL, pieceType, player, ROAD, score, SETTLEMENT, SHIP, threats, threatUpdatedFlag, updated
 
Constructor Summary
SOCPossibleSettlement(SOCPlayer pl, int co, java.util.Vector<SOCPossibleRoad> nr)
          constructor
SOCPossibleSettlement(SOCPossibleSettlement ps)
          copy constructor Note: This will not copy vectors, only make empty ones
 
Method Summary
 void addConflict(SOCPossibleSettlement s)
          add a conflicting settlement
 void addNecessaryRoad(SOCPossibleRoad rd)
          add a possible road to the list of necessary roads
 java.util.Vector<SOCPossibleSettlement> getConflicts()
           
 java.util.Vector<SOCPossibleRoad> getNecessaryRoads()
          Get this possible settlement's list of necessary roads, from constructor and/or addNecessaryRoad(SOCPossibleRoad).
 int getNumberOfNecessaryRoads()
           
(package private)  java.util.Stack<SOCPossibleRoad> getRoadPath()
          Get the shortest road path to this settlement; some bots don't use this.
 int[] getSpeedup()
           
 int getSpeedupTotal()
          Get the total speedup from this settlement.
 void removeConflict(SOCPossibleSettlement s)
          remove a conflicting settlement
 void setNumberOfNecessaryRoads(int num)
          set the minimum number of necessary roads
(package private)  void setRoadPath(java.util.Stack<SOCPossibleRoad> path)
          Shortest road/ship path to this settlement.
 void updateSpeedup()
          update the speedup that this settlement gives.
 
Methods inherited from class soc.robot.SOCPossiblePiece
addBiggestThreat, addThreat, addToScore, clearBiggestThreats, clearThreats, clearUpdateFlag, getBiggestThreats, getCoordinates, getETA, getPlayer, getResourcesToBuild, getScore, getThreats, getType, hasBeenExpanded, isETAUpdated, isThreatUpdated, resetExpandedFlag, resetScore, setETA, setExpandedFlag, subtractFromScore, threatUpdated, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

necessaryRoads

protected java.util.Vector<SOCPossibleRoad> necessaryRoads

conflicts

protected java.util.Vector<SOCPossibleSettlement> conflicts

speedup

protected int[] speedup
Speedup per building type. Indexed from SOCBuildingSpeedEstimate.MIN to SOCBuildingSpeedEstimate.MAXPLUSONE.


numberOfNecessaryRoads

protected int numberOfNecessaryRoads

roadPath

protected java.util.Stack<SOCPossibleRoad> roadPath
Constructor Detail

SOCPossibleSettlement

public SOCPossibleSettlement(SOCPlayer pl,
                             int co,
                             java.util.Vector<SOCPossibleRoad> nr)
constructor

Parameters:
pl - the owner
co - coordinates;
nr - necessaryRoads, or null to create a new empty Vector here

SOCPossibleSettlement

public SOCPossibleSettlement(SOCPossibleSettlement ps)
copy constructor Note: This will not copy vectors, only make empty ones

Parameters:
ps - the possible settlement to copy
Method Detail

getRoadPath

java.util.Stack<SOCPossibleRoad> getRoadPath()
Get the shortest road path to this settlement; some bots don't use this. See setRoadPath(Stack) for details.

Returns:
the shortest road path to this settlement

setRoadPath

void setRoadPath(java.util.Stack<SOCPossibleRoad> path)
Shortest road/ship path to this settlement. Calculated from getNecessaryRoads() by SOCRobotDM.scoreSettlementsForDumb(int, SOCBuildingSpeedEstimate). The bots with SOCRobotDM.SMART_STRATEGY won't calculate this; instead, they pick roads/ships with 0 getNecessaryRoads(), and iteratively simulate building other things after picking such a road.

Parameters:
path - a stack containing the shortest road path to this settlement

getNecessaryRoads

public java.util.Vector<SOCPossibleRoad> getNecessaryRoads()
Get this possible settlement's list of necessary roads, from constructor and/or addNecessaryRoad(SOCPossibleRoad).

Returns:
the list of necessary roads

getNumberOfNecessaryRoads

public int getNumberOfNecessaryRoads()
Returns:
the minimum number of necessary roads

setNumberOfNecessaryRoads

public void setNumberOfNecessaryRoads(int num)
set the minimum number of necessary roads

Parameters:
num - the minimum number of necessary roads

updateSpeedup

public void updateSpeedup()
update the speedup that this settlement gives. This has been a do-nothing method (all code commented out) since March 2004 or earlier.


getConflicts

public java.util.Vector<SOCPossibleSettlement> getConflicts()
Returns:
the list of conflicting settlements

addNecessaryRoad

public void addNecessaryRoad(SOCPossibleRoad rd)
add a possible road to the list of necessary roads

Parameters:
rd - the road

addConflict

public void addConflict(SOCPossibleSettlement s)
add a conflicting settlement

Parameters:
s - the settlement

removeConflict

public void removeConflict(SOCPossibleSettlement s)
remove a conflicting settlement

Parameters:
s - the settlement

getSpeedup

public int[] getSpeedup()
Returns:
the speedup for this settlement

getSpeedupTotal

public int getSpeedupTotal()
Get the total speedup from this settlement. Settlement speedup is currently not used, always 0.

Returns:
the sum of all of the speedup numbers