JSettlers v1.0.6 API
Built ${date}

soc.robot
Class SOCBuildingSpeedEstimate

java.lang.Object
  extended bysoc.robot.SOCBuildingSpeedEstimate

public class SOCBuildingSpeedEstimate
extends java.lang.Object

This class calculates approximately how long it would take a player to build something.


Field Summary
static int CARD
           
static int CITY
           
static int DEFAULT_ROLL_LIMIT
           
static int MAXPLUSONE
           
static int MIN
           
protected static boolean recalc
           
static int ROAD
           
static int SETTLEMENT
           
 
Constructor Summary
SOCBuildingSpeedEstimate()
          this is a constructor
SOCBuildingSpeedEstimate(SOCPlayerNumbers numbers)
          this is a constructor
 
Method Summary
protected  SOCResSetBuildTimePair calculateRollsAccurate(SOCResourceSet startingResources, SOCResourceSet targetResources, int cutoff, boolean[] ports)
          this figures out how many rolls it would take this player to get the target set of resources given a starting set
protected  SOCResSetBuildTimePair calculateRollsFast(SOCResourceSet startingResources, SOCResourceSet targetResources, int cutoff, boolean[] ports)
          this figures out how many rolls it would take this player to get the target set of resources given a starting set
 int[] getEstimatesFromNothingAccurate(boolean[] ports)
           
 int[] getEstimatesFromNothingFast(boolean[] ports)
           
 int[] getEstimatesFromNothingFast(boolean[] ports, int limit)
           
 int[] getEstimatesFromNowAccurate(SOCResourceSet resources, boolean[] ports)
           
 int[] getEstimatesFromNowFast(SOCResourceSet resources, boolean[] ports)
           
 int[] getRollsPerResource()
           
 void recalculateEstimates(SOCPlayerNumbers numbers)
          recalculate both rollsPerResource and resourcesPerRoll
 void recalculateEstimates(SOCPlayerNumbers numbers, int robberHex)
          recalculate both rollsPerResource and resourcesPerRoll using the robber information
 void recalculateResourcesForRoll(SOCPlayerNumbers numbers)
          calculate what resources this player will get on each die roll
 void recalculateResourcesForRoll(SOCPlayerNumbers numbers, int robberHex)
          calculate what resources this player will get on each die roll taking the robber into account
 void recalculateRollsPerResource(SOCPlayerNumbers numbers)
          calculate the estimates
 void recalculateRollsPerResource(SOCPlayerNumbers numbers, int robberHex)
          calculate the estimates assuming that the robber is working
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROAD

public static final int ROAD
See Also:
Constant Field Values

SETTLEMENT

public static final int SETTLEMENT
See Also:
Constant Field Values

CITY

public static final int CITY
See Also:
Constant Field Values

CARD

public static final int CARD
See Also:
Constant Field Values

MIN

public static final int MIN
See Also:
Constant Field Values

MAXPLUSONE

public static final int MAXPLUSONE
See Also:
Constant Field Values

DEFAULT_ROLL_LIMIT

public static final int DEFAULT_ROLL_LIMIT
See Also:
Constant Field Values

recalc

protected static boolean recalc
Constructor Detail

SOCBuildingSpeedEstimate

public SOCBuildingSpeedEstimate(SOCPlayerNumbers numbers)
this is a constructor

Parameters:
numbers - the numbers that the player's pieces are touching

SOCBuildingSpeedEstimate

public SOCBuildingSpeedEstimate()
this is a constructor

Method Detail

getEstimatesFromNothingAccurate

public int[] getEstimatesFromNothingAccurate(boolean[] ports)
Parameters:
ports - the port flags for the player
Returns:
the estimates from nothing

getEstimatesFromNothingFast

public int[] getEstimatesFromNothingFast(boolean[] ports)
Parameters:
ports - the port flags for the player
Returns:
the estimates from nothing

getEstimatesFromNothingFast

public int[] getEstimatesFromNothingFast(boolean[] ports,
                                         int limit)
Parameters:
ports - the port flags for the player
Returns:
the estimates from nothing

getEstimatesFromNowAccurate

public int[] getEstimatesFromNowAccurate(SOCResourceSet resources,
                                         boolean[] ports)
Parameters:
resources - the player's current resources
ports - the player's port flags
Returns:
the estimates from now

getEstimatesFromNowFast

public int[] getEstimatesFromNowFast(SOCResourceSet resources,
                                     boolean[] ports)
Parameters:
resources - the player's current resources
ports - the player's port flags
Returns:
the estimates from now

recalculateEstimates

public void recalculateEstimates(SOCPlayerNumbers numbers)
recalculate both rollsPerResource and resourcesPerRoll


recalculateEstimates

public void recalculateEstimates(SOCPlayerNumbers numbers,
                                 int robberHex)
recalculate both rollsPerResource and resourcesPerRoll using the robber information


recalculateRollsPerResource

public void recalculateRollsPerResource(SOCPlayerNumbers numbers)
calculate the estimates

Parameters:
numbers - the numbers that the player is touching

recalculateRollsPerResource

public void recalculateRollsPerResource(SOCPlayerNumbers numbers,
                                        int robberHex)
calculate the estimates assuming that the robber is working

Parameters:
numbers - the numbers that the player is touching
robberHex - where the robber is

recalculateResourcesForRoll

public void recalculateResourcesForRoll(SOCPlayerNumbers numbers)
calculate what resources this player will get on each die roll

Parameters:
numbers - the numbers that the player is touching

recalculateResourcesForRoll

public void recalculateResourcesForRoll(SOCPlayerNumbers numbers,
                                        int robberHex)
calculate what resources this player will get on each die roll taking the robber into account

Parameters:
numbers - the numbers that the player is touching

getRollsPerResource

public int[] getRollsPerResource()
Returns:
the rolls per resource results

calculateRollsFast

protected SOCResSetBuildTimePair calculateRollsFast(SOCResourceSet startingResources,
                                                    SOCResourceSet targetResources,
                                                    int cutoff,
                                                    boolean[] ports)
                                             throws CutoffExceededException
this figures out how many rolls it would take this player to get the target set of resources given a starting set

Parameters:
startingResources - the starting resources
targetResources - the target resources
cutoff - throw an exception if the total speed is greater than this
ports - a list of port flags
Returns:
the number of rolls
Throws:
CutoffExceededException

calculateRollsAccurate

protected SOCResSetBuildTimePair calculateRollsAccurate(SOCResourceSet startingResources,
                                                        SOCResourceSet targetResources,
                                                        int cutoff,
                                                        boolean[] ports)
                                                 throws CutoffExceededException
this figures out how many rolls it would take this player to get the target set of resources given a starting set

Parameters:
startingResources - the starting resources
targetResources - the target resources
cutoff - throw an exception if the total speed is greater than this
ports - a list of port flags
Returns:
the number of rolls
Throws:
CutoffExceededException

JSettlers v1.0.6 API
Built ${date}