Class Deck

java.lang.Object
com.shr4pnel.casino.base.Deck
Direct Known Subclasses:
BlackjackDeck

public abstract class Deck extends Object

Base class for all Decks of cards

Constructors should be created on a per implementation basis

Since:
0.1.0
See Also:
  • Field Details

    • cards

      protected Stack<Card> cards
    • suitList

      protected final String[] suitList
    • cardTypeList

      protected final String[] cardTypeList
    • cardValueList

      protected final int[] cardValueList
  • Constructor Details

    • Deck

      public Deck()
  • Method Details

    • shuffle

      public void shuffle()
    • drawCard

      public Card drawCard()
      Draw a card from the top of the stack
      Returns:
      A card, or null if the deck is empty
    • drawCards

      public Card[] drawCards(int n)
      Draw a variable number of cards
      Parameters:
      n - The number of cards to draw
      Returns:
      An array of cards, or null if less than one, or more than the length of the deck
    • isEmpty

      public boolean isEmpty()
      Check if the deck is empty

      This is a better alternative to waiting for a null return from drawCard(s)

      Returns:
      true, if the deck is empty