Examples of Hand


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

   */
  private Hand getBestFiveCardHand(MutableSeatedPlayer player) {
    List<Card> cards = new ArrayList<Card>(7);
    cards.addAll(getGame().getCommunityCards());
    cards.addAll(player.getPocketCards());
    return new Hand(cards).getBestFive();
  }
View Full Code Here

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

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

  public void testSixCardHand() {
    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.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SIX, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));

    assertTrue(hand1.getBestFive().getShortDescription().equals(
        HandType.STRAIGHT_FLUSH.getDescription()));

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

    assertTrue(hand2.getBestFive().getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));

    // test hand1>hand 2
    assertTrue(hand1.compareTo(hand2) == 1);

    // test hand1<hand 2

    hand1 = new Hand();
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));

    assertTrue(hand1.compareTo(hand2) == -1);

    // test hand1==hand2
    hand1 = new Hand();
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
View Full Code Here

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

    assertTrue(hand1.compareTo(hand2) == 0);
  }

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

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

    assertTrue(hand1.getBestFive().getShortDescription().equals(
        HandType.STRAIGHT_FLUSH.getDescription()));

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

    assertTrue(hand2.getBestFive().getShortDescription().equals(
        HandType.THREE_OF_A_KIND.getDescription()));

    // test hand1>hand 2
    assertTrue(hand1.compareTo(hand2) == 1);

    // test hand1<hand 2

    hand1 = new Hand();
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.DIAMONDS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.ACE, Suit.HEARTS));

    assertTrue(hand1.compareTo(hand2) == -1);

    // test hand1==hand2
    hand1 = new Hand();
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.FOUR, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.SEVEN, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.EIGHT, Suit.SPADES));
View Full Code Here

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

    assertTrue(hand1.compareTo(hand2) == 0);
  }

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

    hand1 = hand1.add(testExactCard.getExactCard(Rank.KING, Suit.HEARTS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.QUEEN, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.JACK, Suit.CLUBS));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TEN, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.NINE, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.TWO, Suit.SPADES));
    hand1 = hand1.add(testExactCard.getExactCard(Rank.THREE, Suit.DIAMONDS));

    hand2 = hand2.add(testExactCard.getExactCard(Rank.KING, Suit.HEARTS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.QUEEN, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.JACK, Suit.CLUBS));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.TEN, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.NINE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.ACE, Suit.SPADES));
    hand2 = hand2.add(testExactCard.getExactCard(Rank.THREE, Suit.DIAMONDS));

    assertTrue(hand1.compareTo(hand2) == -1);
  }
View Full Code Here

Examples of org.encog.examples.nonlinear.basicstrategy.blackjack.Hand

  }
   
  @Override
  public char play(Table table) {
   
    Hand hand = getCurrentHand();
    Hand dealerHand = table.getDealer().getCurrentHand();
    int upCard = dealerHand.getHand()[1];
    int dealerCardIndex = Shoe.hardValue(upCard)-1;
   
   
    if( hand.isPair() )
    {
View Full Code Here

Examples of org.gnubridge.core.Hand

    expectPlayerToBid(FOUR_HEARTS);
  }

  public void testOpeningOneNTSequence() {
    Auctioneer a = new Auctioneer(West.i());
    BiddingAgent west = new BiddingAgent(a, new Hand("K,2", "A,Q,3", "A,8,6,5,3", "K,J,3"));
    assertEquals(ONE_NOTRUMP, west.getBid());
    a.bid(ONE_NOTRUMP);
    a.bid(PASS);
    BiddingAgent east = new BiddingAgent(a, new Hand("K,8,7,6", "A,3,2", "6,5,3", "Q,4,3"));
    assertEquals(TWO_NOTRUMP, east.getBid());
    a.bid(TWO_NOTRUMP);
    a.bid(PASS);
    assertEquals(THREE_NOTRUMP, west.getBid());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.