Android Open Source - RussianTripleForAndroid Deck






From Project

Back to project page RussianTripleForAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project RussianTripleForAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package eu.veldsoft.russian.triple;
//from   w ww  .  j a va2 s  .c  om
public class Deck {
  static private final Card[] cards = {
      new Card(Card.Rank.NINE, Card.Suit.CLUBS, false, false, false),
      new Card(Card.Rank.TEN, Card.Suit.CLUBS, false, false, false),
      new Card(Card.Rank.JACK, Card.Suit.CLUBS, false, false, false),
      new Card(Card.Rank.QUEEN, Card.Suit.CLUBS, false, false, false),
      new Card(Card.Rank.KING, Card.Suit.CLUBS, false, false, false),
      new Card(Card.Rank.ACE, Card.Suit.CLUBS, false, false, false),
      new Card(Card.Rank.NINE, Card.Suit.HEARTS, false, false, false),
      new Card(Card.Rank.TEN, Card.Suit.HEARTS, false, false, false),
      new Card(Card.Rank.JACK, Card.Suit.HEARTS, false, false, false),
      new Card(Card.Rank.QUEEN, Card.Suit.HEARTS, false, false, false),
      new Card(Card.Rank.KING, Card.Suit.HEARTS, false, false, false),
      new Card(Card.Rank.ACE, Card.Suit.HEARTS, false, false, false),
      new Card(Card.Rank.NINE, Card.Suit.DIAMONDS, false, false, false),
      new Card(Card.Rank.TEN, Card.Suit.DIAMONDS, false, false, false),
      new Card(Card.Rank.JACK, Card.Suit.DIAMONDS, false, false, false),
      new Card(Card.Rank.QUEEN, Card.Suit.DIAMONDS, false, false, false),
      new Card(Card.Rank.KING, Card.Suit.DIAMONDS, false, false, false),
      new Card(Card.Rank.ACE, Card.Suit.DIAMONDS, false, false, false),
      new Card(Card.Rank.NINE, Card.Suit.SPADES, false, false, false),
      new Card(Card.Rank.TEN, Card.Suit.SPADES, false, false, false),
      new Card(Card.Rank.JACK, Card.Suit.SPADES, false, false, false),
      new Card(Card.Rank.QUEEN, Card.Suit.SPADES, false, false, false),
      new Card(Card.Rank.KING, Card.Suit.SPADES, false, false, false),
      new Card(Card.Rank.ACE, Card.Suit.SPADES, false, false, false), };

  public static final int SIZE = cards.length;
  
  static void reset() {
    setAllUnhighlighted();
    setAllFaceDown();
    setAllVisible();
  }
  
  static void shuffle() {
    for (int last = cards.length - 1, r = -1; last > 0; last--) {
      r = Util.PRNG.nextInt(last + 1);
      Card swap = cards[last];
      cards[last] = cards[r];
      cards[r] = swap;
    }
  }

  static void setAllFaseUp() {
    for (Card card : cards) {
      card.faceUp();
    }
  }

  static void setAllFaceDown() {
    for (Card card : cards) {
      card.faceDown();
    }
  }

  static void setAllHighlighted() {
    for (Card card : cards) {
      card.highlight();
    }
  }

  static void setAllUnhighlighted() {
    for (Card card : cards) {
      card.unhighlight();
    }
  }

  static void setAllVisible() {
    for (Card card : cards) {
      card.visible();
    }
  }

  static void setAllInvisible() {
    for (Card card : cards) {
      card.invisible();
    }
  }

  static Card cardAtPosition(int index) throws RuntimeException {
    if (index < 0 || index >= cards.length) {
      throw (new IndexOutOfBoundsException("No such card!"));
    }

    return (cards[index]);
  }

  private Deck() {
  }
}




Java Source Code List

eu.veldsoft.russian.triple.AIBidder.java
eu.veldsoft.russian.triple.Bid.java
eu.veldsoft.russian.triple.Board.java
eu.veldsoft.russian.triple.Card.java
eu.veldsoft.russian.triple.ComputerPlayer.java
eu.veldsoft.russian.triple.Deck.java
eu.veldsoft.russian.triple.GameActivity.java
eu.veldsoft.russian.triple.HumanPlayer.java
eu.veldsoft.russian.triple.NoTrumpComparator.java
eu.veldsoft.russian.triple.Player.java
eu.veldsoft.russian.triple.State.java
eu.veldsoft.russian.triple.Util.java