Package org.cspoker.common.elements.hand

Examples of org.cspoker.common.elements.hand.Hand$UniqueHandHash


    assertTrue(testExactCard.getExactCard(Rank.TWO, Suit.HEARTS)
        .compareTo(testExactCard.getExactCard(Rank.KING, Suit.SPADES)) < 0);
  }

  public void testIterator() {
    hand1 = new Hand();
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.KING, Suit.HEARTS));
View Full Code Here


  @Override
  protected void setUp() throws Exception {
    BasicConfigurator.configure();
   
    hand1 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SIX, Suit.HEARTS));
View Full Code Here

  }
 
  private static TestExactCard testExactCard = new TestExactCard();
 
  public void testHighCardHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    // test hand1 > hand2
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.KING, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.HIGH_CARD.getDescription()));
    assertTrue(hand2.getShortDescription().equals(
        HandType.HIGH_CARD.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // test hand2>hand1
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.KING, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.HIGH_CARD.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);
    // test hand2==hand1
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.HIGH_CARD.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.HIGH_CARD.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testPairHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    // test hand1>hand2
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.PAIR.getDescription()));
    assertTrue(hand2.getShortDescription().equals(
        HandType.PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.KING, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand2.getShortDescription().equals(
        HandType.PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // test hand2>hand1
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand2.getShortDescription().equals(
        HandType.PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    // test hand2==hand1

    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand2.getShortDescription().equals(
        HandType.PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testDoublePairHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.TWO_PAIR.getDescription()));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertFalse(hand2.getShortDescription().equals(
        HandType.TWO_PAIR.getDescription()));

    // hand1 >hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.TWO_PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // hand1 <hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.TWO_PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    hand2 = hand1;
    assertTrue(hand2.getShortDescription().equals(
        HandType.TWO_PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.TWO_PAIR.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testThreeOfAKindHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertFalse(hand2.getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));

    // hand1 >hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // hand1 <hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    hand2 = hand1;
    assertTrue(hand2.getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.THREE_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testFourOfAKindHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.FOUR_OF_A_KIND.getDescription()));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertFalse(hand2.getShortDescription().equals(
        HandType.FOUR_OF_A_KIND.getDescription()));

    // hand1 >hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.FOUR_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // hand1 <hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.FOUR_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    hand2 = hand1;
    assertTrue(hand2.getShortDescription().equals(
        HandType.FOUR_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.FOUR_OF_A_KIND.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testFullHouseHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.FULL_HOUSE.getDescription()));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertFalse(hand2.getShortDescription().equals(
        HandType.FULL_HOUSE.getDescription()));

    // hand1 >hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.FULL_HOUSE.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // hand1 <hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.FULL_HOUSE.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    hand2 = hand1;
    assertTrue(hand2.getShortDescription().equals(
        HandType.FULL_HOUSE.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.FULL_HOUSE.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testFlushHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.NINE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.FLUSH.getDescription()));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertFalse(hand2.getShortDescription().equals(
        HandType.FLUSH.getDescription()));

    // hand1 >hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SEVEN, Suit.CLUBS));
    assertTrue(hand2.getShortDescription().equals(
        HandType.FLUSH.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // hand1 <hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.NINE, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.HEARTS));
    assertTrue(hand2.getShortDescription().equals(
        HandType.FLUSH.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    hand2 = hand1;
    assertTrue(hand2.getShortDescription().equals(
        HandType.FLUSH.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

        HandType.FLUSH.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }

  public void testStraightHands() {
    Hand hand1 = new Hand();
    Hand hand2 = new Hand();

    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FIVE, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SIX, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertTrue(hand1.getShortDescription().equals(
        HandType.STRAIGHT.getDescription()));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));

    assertFalse(hand2.getShortDescription().equals(
        HandType.STRAIGHT.getDescription()));

    // hand1 >hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FIVE, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TWO, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.STRAIGHT.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 1);

    // hand1 <hand 2
    hand2 = new Hand();
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.QUEEN, Suit.DIAMONDS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.KING, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.JACK, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TEN, Suit.SPADES));
    assertTrue(hand2.getShortDescription().equals(
        HandType.STRAIGHT.getDescription()));
    assertTrue(hand1.compareTo(hand2) == -1);

    hand2 = hand1;
    assertTrue(hand2.getShortDescription().equals(
        HandType.STRAIGHT.getDescription()));
    assertTrue(hand1.compareTo(hand2) == 0);
  }
View Full Code Here

TOP

Related Classes of org.cspoker.common.elements.hand.Hand$UniqueHandHash

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.