Class AbstractStrategy

    • 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_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
      • name

        protected java.lang.String name
        The strategy name.
      • strategies

        protected static final java.util.List strategies
        The strategies.
    • Constructor Detail

      • AbstractStrategy

        public AbstractStrategy​(java.lang.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 java.lang.String getName()
        Get the name.
        Specified by:
        getName in interface IStrategy
        Returns:
        The strategy name.
      • toString

        public java.lang.String toString()
        Return a string representation.
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Return the hash code.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Test if two strategies are equal.
        Overrides:
        equals in class java.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.