chkuendig / cspoker

Automatically exported from code.google.com/p/cspoker
0 stars 0 forks source link

Implementation of HandEval.decode #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I added this method to HandEval as I found it useful for debugging.

  public static Set<Card> decode(long encodedCards) {
    Set<Card> cards = new HashSet<Card>();
    for (int i = 0; i < 52; i++) {
      if (((encodedCards >>> i) & 1) == 1) {
        cards.add(Card.valueOf(Rank.values()[i % 13].name()
            + "_" + Suit.values()[i / 13].name()));
      }
    }
    return cards;
  }

Original issue reported on code.google.com by mistert...@yahoo.com on 11 Apr 2009 at 6:24