Package communist.poker

Examples of communist.poker.Card


  private void refresh_hand(boolean force) {
    System.out.println("refreshing hand force: " + force);
    for (int i = 0; i < 5; i++) {
      if (force || !holds.contains(new Integer(i))) {
        Card c = cards.draw_card();
        hand[i].update_card(c);
        hand_hold[i].setBackground(Color.GRAY);
      }
    }
    holds = new ArrayList<Integer>();
View Full Code Here


        hand_cards[c] = hand[c].card;
      }
      // some arbitrary number of iterations?
      for (int n = 0; n < 10; n++) {
        for (int a = 0; a < 4; a++) {
          Card c_a = hand_cards[a];
          Card c_b = hand_cards[a + 1];
          if (c_b.get_rank() < c_a.get_rank()) {
            hand_cards[a] = c_b;
            hand_cards[a + 1] = c_a;
          }
        }
      }
View Full Code Here

  public void shuffle() {
    Random r = new Random();
    for (int i = 0; i < DECK_LENGTH; i++) {
      int a_index = r.nextInt(DECK_LENGTH);
      int b_index = r.nextInt(DECK_LENGTH);
      Card a = cards[a_index];
      Card b = cards[b_index];
      cards[a_index] = b;
      cards[b_index] = a;
    }
  }
View Full Code Here

      cards[b_index] = a;
    }
  }
 
  public Card draw_card() {
    Card c = cards[0];
    Card[] new_deck = new Card[DECK_LENGTH];
    for (int i = 0; i < DECK_LENGTH - 1; i++) {
      new_deck[i] = this.cards[i + 1];
    }
    new_deck[DECK_LENGTH -1] = c;
View Full Code Here

 
  private void create_deck() {
    for (int x = 0; x < 13; x++) {
      for (int y = 0; y < 4; y++) {
        int card_index = get_index_2d(x, y, 13);
        cards[card_index] = new Card(y, x);
      }
    }
  }
View Full Code Here

TOP

Related Classes of communist.poker.Card

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.