Jadex 0.96

jadex.examples.blackjack.player.strategies
Class AbstractStrategy

java.lang.Object
  extended by jadex.examples.blackjack.player.strategies.AbstractStrategy
All Implemented Interfaces:
IStrategy
Direct Known Subclasses:
ConstantStrategy, StochasticTable

public abstract class AbstractStrategy
extends Object
implements IStrategy

Abstract base class for strategies.


Field Summary
static String CONSTANT_CAREFUL
           
static String CONSTANT_RISKY
           
static String CONSTANT_VERY_CAREFUL
          Constants for strategy names.
static String CONSTANT_VERY_RISKY
           
static String HUMAN_PLAYER
           
static String STOCHASTIC_TABLE
           
 
Constructor Summary
AbstractStrategy(String name)
          Create a new strategy.
 
Method Summary
abstract  boolean drawCard(Card[] agentcards, Card dealercard)
          Depending on the strategy, this methods decides whether to draw one more card or not.
 boolean equals(Object o)
          Test if two strategies are equal.
 String getName()
          Get the name.
static IStrategy[] getStrategies()
          Get all strategies.
static IStrategy getStrategy(String name)
          Get a strategy per name.
static 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.
 String toString()
          Return a string representation.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTANT_VERY_CAREFUL

public static final String CONSTANT_VERY_CAREFUL
Constants for strategy names.

See Also:
Constant Field Values

CONSTANT_CAREFUL

public static final String CONSTANT_CAREFUL
See Also:
Constant Field Values

CONSTANT_RISKY

public static final String CONSTANT_RISKY
See Also:
Constant Field Values

CONSTANT_VERY_RISKY

public static final String CONSTANT_VERY_RISKY
See Also:
Constant Field Values

STOCHASTIC_TABLE

public static final String STOCHASTIC_TABLE
See Also:
Constant Field Values

HUMAN_PLAYER

public static final String HUMAN_PLAYER
See Also:
Constant Field Values
Constructor Detail

AbstractStrategy

public AbstractStrategy(String name)
Create a new strategy.

Method Detail

makeBet

public abstract int makeBet(int account)
Depending on the strategy, this methods calculates the bet-amount.

Specified by:
makeBet in interface IStrategy
Parameters:
account - The account-status of the player.
Returns:
how much money the player should bet.

drawCard

public abstract boolean drawCard(Card[] agentcards,
                                 Card dealercard)
Depending on the strategy, this methods decides whether to draw one more card or not.

Specified by:
drawCard in interface IStrategy
Parameters:
agentcards - A String-array containing all the players cards.
dealercard - This String represents the dealer's open card.
Returns:
whether the player should draw one more card or not.

getName

public String getName()
Get the name.

Specified by:
getName in interface IStrategy
Returns:
The strategy name.

toString

public String toString()
Return a string representation.

Overrides:
toString in class Object

hashCode

public int hashCode()
Return the hash code.

Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Test if two strategies are equal.

Overrides:
equals in class Object

getStrategyNames

public static String[] getStrategyNames()
Get the strategy names.

Returns:
The strategy names.

getStrategy

public static IStrategy getStrategy(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.

Jadex 0.96

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.