Class AbstractStrategy
- java.lang.Object
-
- jadex.bdi.examples.blackjack.player.strategies.AbstractStrategy
-
- All Implemented Interfaces:
IStrategy
- Direct Known Subclasses:
ConstantStrategy,StochasticTable
public abstract class AbstractStrategy extends java.lang.Object implements IStrategy
Abstract base class for strategies.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONSTANT_CAREFULstatic java.lang.StringCONSTANT_RISKYstatic java.lang.StringCONSTANT_VERY_CAREFULConstants for strategy names.static java.lang.StringCONSTANT_VERY_RISKYstatic java.lang.StringHUMAN_PLAYERprotected java.lang.StringnameThe strategy name.static java.lang.StringSTOCHASTIC_TABLEprotected static java.util.ListstrategiesThe strategies.
-
Constructor Summary
Constructors Constructor Description AbstractStrategy(java.lang.String name)Create a new strategy.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleandrawCard(Card[] agentcards, Card dealercard)Depending on the strategy, this methods decides whether to draw one more card or not.booleanequals(java.lang.Object o)Test if two strategies are equal.java.lang.StringgetName()Get the name.static IStrategy[]getStrategies()Get all strategies.static IStrategygetStrategy(java.lang.String name)Get a strategy per name.static java.lang.String[]getStrategyNames()Get the strategy names.inthashCode()Return the hash code.abstract intmakeBet(int account)Depending on the strategy, this methods calculates the bet-amount.java.lang.StringtoString()Return a string representation.
-
-
-
Field Detail
-
CONSTANT_VERY_CAREFUL
public static final java.lang.String CONSTANT_VERY_CAREFUL
Constants for strategy names.- See Also:
- Constant Field Values
-
CONSTANT_CAREFUL
public static final java.lang.String CONSTANT_CAREFUL
- See Also:
- Constant Field Values
-
CONSTANT_RISKY
public static final java.lang.String CONSTANT_RISKY
- See Also:
- Constant Field Values
-
CONSTANT_VERY_RISKY
public static final java.lang.String CONSTANT_VERY_RISKY
- See Also:
- Constant Field Values
-
STOCHASTIC_TABLE
public static final java.lang.String STOCHASTIC_TABLE
- See Also:
- Constant Field Values
-
HUMAN_PLAYER
public static final java.lang.String HUMAN_PLAYER
- See Also:
- Constant Field Values
-
name
protected java.lang.String name
The strategy name.
-
strategies
protected static final java.util.List strategies
The strategies.
-
-
Method Detail
-
makeBet
public abstract int makeBet(int account)
Depending on the strategy, this methods calculates the bet-amount.
-
drawCard
public abstract boolean drawCard(Card[] agentcards, Card dealercard)
Depending on the strategy, this methods decides whether to draw one more card or not.
-
getName
public java.lang.String getName()
Get the name.
-
toString
public java.lang.String toString()
Return a string representation.- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Return the hash code.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Test if two strategies are equal.- Overrides:
equalsin classjava.lang.Object
-
getStrategyNames
public static java.lang.String[] getStrategyNames()
Get the strategy names.- Returns:
- The strategy names.
-
getStrategy
public static IStrategy getStrategy(java.lang.String name)
Get a strategy per name.- Parameters:
name- The name.- Returns:
- The strategy.
-
getStrategies
public static IStrategy[] getStrategies()
Get all strategies.- Returns:
- All strategies.
-
-