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.String
CONSTANT_CAREFUL
static java.lang.String
CONSTANT_RISKY
static java.lang.String
CONSTANT_VERY_CAREFUL
Constants for strategy names.static java.lang.String
CONSTANT_VERY_RISKY
static java.lang.String
HUMAN_PLAYER
protected java.lang.String
name
The strategy name.static java.lang.String
STOCHASTIC_TABLE
protected static java.util.List
strategies
The 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 boolean
drawCard(Card[] agentcards, Card dealercard)
Depending on the strategy, this methods decides whether to draw one more card or not.boolean
equals(java.lang.Object o)
Test if two strategies are equal.java.lang.String
getName()
Get the name.static IStrategy[]
getStrategies()
Get all strategies.static IStrategy
getStrategy(java.lang.String name)
Get a strategy per name.static java.lang.String[]
getStrategyNames()
Get the strategy names.int
hashCode()
Return the hash code.abstract int
makeBet(int account)
Depending on the strategy, this methods calculates the bet-amount.java.lang.String
toString()
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:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
Return the hash code.- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Test if two strategies are equal.- Overrides:
equals
in 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.
-
-