Game
Date: 2017-05-13

game_backend

## Class Game

- java.lang.Object
- - game_backend.Game

- All Implemented Interfaces:
    Play

      public class Game
      extends java.lang.Object
      implements Play

  Represents a generic game of Poker. The specifications for a given variant are specified by the attributes and methods of its attribute variant
  Author:
    João Vieira, Guilherme Reis, Catarina Santos

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `actualBet`
    `private Deck` | `deck`
    `private PlayVariant` | `variant`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Game(PlayVariant variant)` Constructor of Game in which deck is initialized as default
    `Game(PlayVariant variant, java.util.ArrayList<Card> cards)` Constructor of Game in which a list of cards is supplied

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `advice(Card[] cards)` For a given hand, retrieves the cards that should be held in order to achieve the maximum gain (greedy way)
    `Card[]` | `deal(int credits)` Receives certain amount and retrieves five cards
    `java.lang.String` | `evaluateHand(Card[] cards)` Returns the name of the awarded hand by asking what is it to its variant, if it exists, otherwise returns null
    `java.util.Map<java.lang.String,java.lang.Integer>` | `getStats()` Retrieves the statistics by asking which are they to its variant
    `int` | `getWins(java.lang.String nameOfHand)` Retrieves the prize for a given awarded hand by asking it to its variant
    `void` | `prepareRound()` Orders the deck to shuffle
    `void` | `receiveCards(Card[] cards)` Puts the received cards in deck
    `Card[]` | `retrieveCards(int n)` Retrieves cards from deck

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

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

- - ### Field Detail

    - #### variant

          private PlayVariant variant

    - #### deck

          private Deck deck

    - #### actualBet

          private int actualBet

  - ### Constructor Detail

    - #### Game

          public Game(PlayVariant variant,
                      java.util.ArrayList<Card> cards)

      Constructor of Game in which a list of cards is supplied
      Parameters:
        `variant` - Variant of Poker that fully specifies the details of its strategy and gains
        `cards` - List of cards to initialize the deck

    - #### Game

          public Game(PlayVariant variant)

      Constructor of Game in which deck is initialized as default
      Parameters:
        `variant` - Variant of Poker that fully specifies the details of its strategy and gains

  - ### Method Detail

    - #### advice

          public int[] advice(Card[] cards)

      For a given hand, retrieves the cards that should be held in order to achieve the maximum gain (greedy way)
      Specified by:
        `advice` in interface `Play`
      Parameters:
        `cards` - Cards to be considered
      Returns:
        int[] Positions that should be held according to the strategy

    - #### deal

          public Card[] deal(int credits)

      Receives certain amount and retrieves five cards
      Specified by:
        `deal` in interface `Play`
      Parameters:
        `credits` - Amount of credits that were bet
      Returns:
        Card[] Cards retrieved by the game

    - #### getStats

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

      Retrieves the statistics by asking which are they to its variant
      Specified by:
        `getStats` in interface `Play`
      Returns:
        Map<String, Integer> List of all awarded hands (or not) and number of hits untill now

    - #### evaluateHand

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

      Returns the name of the awarded hand by asking what is it to its variant, if it exists, otherwise returns null
      Specified by:
        `evaluateHand` in interface `Play`
      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

    - #### getWins

          public int getWins(java.lang.String nameOfHand)

      Retrieves the prize for a given awarded hand by asking it to its variant
      Specified by:
        `getWins` in interface `Play`
      Parameters:
        `nameOfHand` - Names the awarded hand
      Returns:
        int Prize for this hand and this number of credits

    - #### retrieveCards

          public Card[] retrieveCards(int n)

      Retrieves cards from deck
      Specified by:
        `retrieveCards` in interface `Play`
      Parameters:
        `n` - Number of cards to retrieve
      Returns:
        Card[] Cards retrieved

    - #### receiveCards

          public void receiveCards(Card[] cards)

      Puts the received cards in deck
      Specified by:
        `receiveCards` in interface `Play`
      Parameters:
        `cards` - Cards that are to be put in deck

    - #### prepareRound

          public void prepareRound()

      Orders the deck to shuffle
      Specified by:
        `prepareRound` in interface `Play`