JSettlers v1.0.6 API
Built ${date}

soc.robot
Class SOCRobotDM

java.lang.Object
  extended bysoc.robot.SOCRobotDM

public class SOCRobotDM
extends java.lang.Object

Moved the routines that pick what to build next out of SOCRobotBrain. Didn't want to call this SOCRobotPlanner because it doesn't really plan, but you could think of it that way. DM = Decision Maker

Author:
Robert S. Thomas

Field Summary
protected  float adversarialFactor
           
protected  SOCRobotBrain brain
           
protected  java.util.Stack buildingPlan
           
protected static int CITY_CHOICE
           
protected  float devCardMultiplier
           
protected static java.text.DecimalFormat df1
           
protected  float etaBonusFactor
           
static int FAST_STRATEGY
           
protected  SOCPossibleCity favoriteCity
           
protected  SOCPossibleRoad favoriteRoad
           
protected  SOCPossibleSettlement favoriteSettlement
           
protected  SOCGame game
           
protected  java.util.Vector goodRoads
           
protected  java.util.Vector goodSettlements
           
protected static int LA_CHOICE
           
protected  float leaderAdversarialFactor
           
protected static int LR_CHOICE
           
protected  int maxETA
           
protected  int maxGameLength
           
protected static int ONE_OF_EACH
           
protected  SOCPlayer ourPlayerData
           
protected  SOCPlayerTracker ourPlayerTracker
           
protected  java.util.HashMap playerTrackers
           
protected  SOCPossibleCard possibleCard
           
protected static int SETTLEMENT_CHOICE
           
static int SMART_STRATEGY
          used for describing strategies
protected  java.util.Vector threatenedRoads
           
protected  java.util.Vector threatenedSettlements
           
protected  float threatMultiplier
           
protected static int TWO_CITIES
           
protected static int TWO_SETTLEMENTS
          used in planStuff
protected static int WIN_LA
           
protected static int WIN_LR
           
 
Constructor Summary
SOCRobotDM(SOCRobotBrain br)
          constructor
SOCRobotDM(SOCRobotParameters params, java.util.HashMap pt, SOCPlayerTracker opt, SOCPlayer opd, java.util.Stack bp)
          constructor this is if you don't want to use a brain
 
Method Summary
protected  float calcWGETABonus(java.util.HashMap trackersBefore, java.util.HashMap trackersAfter)
          calc the win game eta bonus
 float calcWGETABonusAux(int[] originalWGETAs, java.util.HashMap trackersAfter, java.util.Vector leaders)
          calcWGETABonusAux
protected  void dumbFastGameStrategy(int[] buildingETAs)
          dumbFastGameStrategy uses rules to determine what to build next
 SOCPossibleCard getDevCardScore(int cardETA, int leadersCurrentWGETA)
          calc dev card score
 float getETABonus(int eta, int leadWGETA, float bonus)
          calc eta bonus
 SOCPossibleCity getFavoriteCity()
           
 SOCPossibleRoad getFavoriteRoad()
           
 SOCPossibleSettlement getFavoriteSettlement()
           
 SOCPossibleCard getPossibleCard()
           
protected  float getWinGameETABonus(SOCPossiblePiece posPiece)
          add a bonus to the possible piece score based on the change in win game ETA
protected  float getWinGameETABonusForRoad(SOCPossibleRoad posRoad, int roadETA, int leadersCurrentWGETA, java.util.HashMap playerTrackers)
          add a bonus to the road score based on the change in win game ETA for this one road
 void planStuff(int strategy)
          make some building plans
protected  void scorePossibleSettlements(int settlementETA, int leadersCurrentWGETA)
          score possible settlements for smartStrategy
protected  void scoreSettlementsForDumb(int settlementETA, SOCBuildingSpeedEstimate ourBSE)
          score all possible settlements by getting their speedup total calculate ETA by finding shortest path and then using a SOCBuildingSpeedEstimate to find the ETA
protected  void smartGameStrategy(int[] buildingETAs)
          smart game strategy use WGETA to determine best move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

df1

protected static final java.text.DecimalFormat df1

maxGameLength

protected int maxGameLength

maxETA

protected int maxETA

etaBonusFactor

protected float etaBonusFactor

adversarialFactor

protected float adversarialFactor

leaderAdversarialFactor

protected float leaderAdversarialFactor

devCardMultiplier

protected float devCardMultiplier

threatMultiplier

protected float threatMultiplier

LA_CHOICE

protected static final int LA_CHOICE
See Also:
Constant Field Values

LR_CHOICE

protected static final int LR_CHOICE
See Also:
Constant Field Values

CITY_CHOICE

protected static final int CITY_CHOICE
See Also:
Constant Field Values

SETTLEMENT_CHOICE

protected static final int SETTLEMENT_CHOICE
See Also:
Constant Field Values

TWO_SETTLEMENTS

protected static final int TWO_SETTLEMENTS
used in planStuff

See Also:
Constant Field Values

TWO_CITIES

protected static final int TWO_CITIES
See Also:
Constant Field Values

ONE_OF_EACH

protected static final int ONE_OF_EACH
See Also:
Constant Field Values

WIN_LA

protected static final int WIN_LA
See Also:
Constant Field Values

WIN_LR

protected static final int WIN_LR
See Also:
Constant Field Values

SMART_STRATEGY

public static final int SMART_STRATEGY
used for describing strategies

See Also:
Constant Field Values

FAST_STRATEGY

public static final int FAST_STRATEGY
See Also:
Constant Field Values

brain

protected SOCRobotBrain brain

playerTrackers

protected java.util.HashMap playerTrackers

ourPlayerTracker

protected SOCPlayerTracker ourPlayerTracker

ourPlayerData

protected SOCPlayer ourPlayerData

buildingPlan

protected java.util.Stack buildingPlan

game

protected SOCGame game

threatenedRoads

protected java.util.Vector threatenedRoads

goodRoads

protected java.util.Vector goodRoads

favoriteRoad

protected SOCPossibleRoad favoriteRoad

threatenedSettlements

protected java.util.Vector threatenedSettlements

goodSettlements

protected java.util.Vector goodSettlements

favoriteSettlement

protected SOCPossibleSettlement favoriteSettlement

favoriteCity

protected SOCPossibleCity favoriteCity

possibleCard

protected SOCPossibleCard possibleCard
Constructor Detail

SOCRobotDM

public SOCRobotDM(SOCRobotBrain br)
constructor

Parameters:
br - the robot brain

SOCRobotDM

public SOCRobotDM(SOCRobotParameters params,
                  java.util.HashMap pt,
                  SOCPlayerTracker opt,
                  SOCPlayer opd,
                  java.util.Stack bp)
constructor this is if you don't want to use a brain

Parameters:
params - the robot parameters
pt - the player trackers
opt - our player tracker
opd - our player data
bp - our building plan
Method Detail

getFavoriteSettlement

public SOCPossibleSettlement getFavoriteSettlement()
Returns:
favorite settlement

getFavoriteCity

public SOCPossibleCity getFavoriteCity()
Returns:
favorite city

getFavoriteRoad

public SOCPossibleRoad getFavoriteRoad()
Returns:
favorite road

getPossibleCard

public SOCPossibleCard getPossibleCard()
Returns:
possible card

planStuff

public void planStuff(int strategy)
make some building plans

Parameters:
strategy - an integer that determines which strategy is used (SMART_STRATEGY | FAST_STRATEGY)

dumbFastGameStrategy

protected void dumbFastGameStrategy(int[] buildingETAs)
dumbFastGameStrategy uses rules to determine what to build next

Parameters:
buildingETAs - the etas for building something

scoreSettlementsForDumb

protected void scoreSettlementsForDumb(int settlementETA,
                                       SOCBuildingSpeedEstimate ourBSE)
score all possible settlements by getting their speedup total calculate ETA by finding shortest path and then using a SOCBuildingSpeedEstimate to find the ETA

Parameters:
settlementETA - eta for building a settlement from now

smartGameStrategy

protected void smartGameStrategy(int[] buildingETAs)
smart game strategy use WGETA to determine best move

Parameters:
buildingETAs - the etas for building something

scorePossibleSettlements

protected void scorePossibleSettlements(int settlementETA,
                                        int leadersCurrentWGETA)
score possible settlements for smartStrategy


getWinGameETABonus

protected float getWinGameETABonus(SOCPossiblePiece posPiece)
add a bonus to the possible piece score based on the change in win game ETA

Parameters:
posPiece - the possible piece that we're scoring

getWinGameETABonusForRoad

protected float getWinGameETABonusForRoad(SOCPossibleRoad posRoad,
                                          int roadETA,
                                          int leadersCurrentWGETA,
                                          java.util.HashMap playerTrackers)
add a bonus to the road score based on the change in win game ETA for this one road

Parameters:
posRoad - the possible piece that we're scoring
roadETA - the eta for the road
leadersCurrentWGETA - the leaders current WGETA
playerTrackers - the player trackers (passed in as an argument for figuring out road building plan)

calcWGETABonus

protected float calcWGETABonus(java.util.HashMap trackersBefore,
                               java.util.HashMap trackersAfter)
calc the win game eta bonus

Parameters:
trackersBefore - list of player trackers before move
trackersAfter - list of player trackers after move

calcWGETABonusAux

public float calcWGETABonusAux(int[] originalWGETAs,
                               java.util.HashMap trackersAfter,
                               java.util.Vector leaders)
calcWGETABonusAux

Parameters:
originalWGETAs - the original WGETAs
trackersAfter - the playerTrackers after the change
leaders - a list of leaders

getDevCardScore

public SOCPossibleCard getDevCardScore(int cardETA,
                                       int leadersCurrentWGETA)
calc dev card score


getETABonus

public float getETABonus(int eta,
                         int leadWGETA,
                         float bonus)
calc eta bonus

Parameters:
leadWGETA - the wgeta of the leader
eta - the building eta
Returns:
the eta bonus

JSettlers v1.0.6 API
Built ${date}