DoubleBonus
Date: 2017-05-13

game_backend

## Class DoubleBonus

- java.lang.Object
- - game_backend.PokerRules
  - - game_backend.DoubleBonus

- All Implemented Interfaces:
    PlayVariant

      public class DoubleBonus
      extends PokerRules
      implements PlayVariant

  Class that implements the features of the Poker's variant double bonus
  Author:
    João Vieira, Guilherme Reis, Catarina Santos

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static java.util.HashMap<java.lang.String,java.lang.Integer[]>` | `scoreBoard`
    `private java.util.LinkedHashMap<java.lang.String,java.lang.Integer>` | `statistics`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DoubleBonus()` Creates a double bonus variant, which, in this case, means only initialize the statistics since they are the only non static attributes of this class

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `advice(Card[] cards)` Implements the strategy for this variant of Poker.
    `private static java.util.HashMap<java.lang.String,java.lang.Integer[]>` | `createScoreBoard()`
    `java.lang.String` | `evaluateHand(Card[] cards)` Returns the name of the awarded hand if it exists, otherwise returns null
    `private static java.util.ArrayList<Card[]>` | `getListOfDebugHands()` Only exist for debug purposes.
    `java.util.HashMap<java.lang.String,java.lang.Integer>` | `getStats()` Shows the statistics of awarded (or not) hands hit until now
    `int` | `getValueOfHand(java.lang.String nameOfHand, int bettedCredits)` Retrieves the prize for a given awarded hand
    `private void` | `initializeStatistics()` Method that initializes the statistics

    - ### Methods inherited from class game_backend.PokerRules

      `computeCandidateStraights, computeSameRank, computeSameSuit, getHighCards, getIntFromList, intersect, isAce, isAKQJUnsuited, isFlush, isFourOfAKind, isFourToAFlush, isFourToAnInsideStraightWithNHighCards, isFourToAnInsideStraightWithNoHighCards, isFourToAnInsideStraightWithOneHighCard, isFourToAnInsideStraightWithThreeHighCards, isFourToAnInsideStraightWithTwoHighCards, isFourToAnOutsideStraight, isFourToAStraightFlush, isFourToRoyalFlush, isFullHouse, isHighPair, isJackOrQueenOrKing, isJTSuited, isKJUnsuited, isKQJUnsuited, isKQUnsuited, isKTSuited, isLowPair, isNOfAKind, isNToARoyalFlush, isQJSuited, isQJUnsuited, isQTSuited, isRoyalFlush, isStraight, isStraightFlush, isThreeAces, isThreeOfAKind, isThreeToAFlushWithNHighCards, isThreeToAFlushWithNoHighCards, isThreeToAFlushWithOneHighCard, isThreeToAFlushWithTwoHighCards, isThreeToARoyalFlush, isThreeToAStraightFlushTypeOne, isThreeToAStraightFlushTypeThree, isThreeToAStraightFlushTypeTwo, isTwoPair, isTwoSuitedHighCards, populateWithComutations`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### scoreBoard

          private static final java.util.HashMap<java.lang.String,java.lang.Integer[]> scoreBoard

    - #### statistics

          private java.util.LinkedHashMap<java.lang.String,java.lang.Integer> statistics

  - ### Constructor Detail

    - #### DoubleBonus

          public DoubleBonus()

      Creates a double bonus variant, which, in this case, means only initialize the statistics since they are the only non static attributes of this class

  - ### Method Detail

    - #### createScoreBoard

          private static java.util.HashMap<java.lang.String,java.lang.Integer[]> createScoreBoard()

    - #### initializeStatistics

          private void initializeStatistics()

      Method that initializes the statistics

    - #### advice

          public int[] advice(Card[] cards)

      Implements the strategy for this variant of Poker. It uses the general Poker rules but gives priority to what is more useful according to the returns of the variant
      Specified by:
        `advice` in interface `PlayVariant`
      Specified by:
        `advice` in class `PokerRules`
      Parameters:
        `cards` - Sequence of cards to be evaluated. They come in number of 5
      Returns:
        int[] Cards that, according to the game strategy, should be held

    - #### evaluateHand

          public java.lang.String evaluateHand(Card[] cards)

      Returns the name of the awarded hand if it exists, otherwise returns null
      Specified by:
        `evaluateHand` in interface `PlayVariant`
      Specified by:
        `evaluateHand` in class `PokerRules`
      Parameters:
        `cards` - Vector of cards (in number of 5) that are to be considered
      Returns:
        String name of awarded hand if it exists; null otherwise

    - #### getStats

          public java.util.HashMap<java.lang.String,java.lang.Integer> getStats()

      Shows the statistics of awarded (or not) hands hit until now
      Specified by:
        `getStats` in interface `PlayVariant`
      Returns:
        HashMap<String, Integer> List of hands and number of hits of each one until now

    - #### getListOfDebugHands

          private static java.util.ArrayList<Card[]> getListOfDebugHands()

      Only exist for debug purposes. This function is not offered in any API
      Returns:
        ArrayList<Card[]> List of arrays of 5 cards for debug effects

    - #### getValueOfHand

          public int getValueOfHand(java.lang.String nameOfHand,
                                    int bettedCredits)

      Retrieves the prize for a given awarded hand
      Specified by:
        `getValueOfHand` in interface `PlayVariant`
      Parameters:
        `nameOfHand` - Names the awarded hand
        `bettedCredits` - Amount of credits that where bet before getting this hand
      Returns:
        int Prize for this hand and this number of credits