SingleDeck.java :  » Game » bestcardgameever-android » com » sheepzkeen » yaniv » Android Open Source

Android Open Source » Game » bestcardgameever android 
bestcardgameever android » com » sheepzkeen » yaniv » SingleDeck.java
package com.sheepzkeen.yaniv;

import java.util.Collections;
import java.util.Stack;

/**
 * This class represents a deck of 54 cards that includes 13 cards X 4 suits + 2 jokers
 * it has the ability to dispense a card
 * @author Elad
 *
 */
public class SingleDeck extends PlayingCardsCollection {
  



  public SingleDeck() {
    super();
    // Create a temporary deck
    Stack<PlayingCard> deckTemp = new Stack<PlayingCard>();
    // Add the 52 suit\value combinations
    for (char suit : suits)  {
      for (char value : values) {
        deckTemp.add(new PlayingCard(suit,value));
      }
      
    }
    // Now add the Jokers
    deckTemp.add(new PlayingCard(PlayingCard.RED_SUIT,PlayingCard.JOKER));
    deckTemp.add(new PlayingCard(PlayingCard.BLACK_SUIT,PlayingCard.JOKER));
    // Shuffle it
    Collections.shuffle(deckTemp);
    // And lets get it on!
    cards = deckTemp;
    
  }
  


}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.