Package org.gnubridge.core

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


import org.gnubridge.core.deck.Three;
import org.gnubridge.core.deck.Two;

public class PointCalculatorTest extends TestCase {
  public void testHighCardPoints() {
    PointCalculator dh = new PointCalculator(new Hand(Ace.of(Diamonds.i()), Two.of(Spades.i()),
        King.of(Hearts.i()), Queen.of(Hearts.i()), Jack.of(Clubs.i())));
    assertEquals(10, dh.getHighCardPoints());
  }
View Full Code Here

        King.of(Hearts.i()), Queen.of(Hearts.i()), Jack.of(Clubs.i())));
    assertEquals(10, dh.getHighCardPoints());
  }

  public void testGetDistributionalPoints() {
    PointCalculator dh = new PointCalculator(new Hand(Ace.of(Diamonds.i()), Two.of(Spades.i()),
        King.of(Hearts.i()), Three.of(Spades.i()), Queen.of(Hearts.i()), Jack.of(Hearts.i())));
    assertEquals(6, dh.getDistributionalPoints());
  }
View Full Code Here

        King.of(Hearts.i()), Three.of(Spades.i()), Queen.of(Hearts.i()), Jack.of(Hearts.i())));
    assertEquals(6, dh.getDistributionalPoints());
  }

  public void testGetCombinedPointsFlawedColors() {
    PointCalculator dh = new PointCalculator(new Hand(Ace.of(Diamonds.i()), King.of(Clubs.i()),
        Jack.of(Spades.i()), Queen.of(Hearts.i()), Three.of(Spades.i()), Jack.of(Hearts.i())));
    assertEquals((4 + 2) + 3 + 1 + 3, dh.getCombinedPoints());
  }
View Full Code Here

  }

  //A balanced hand contains no singleton or void and at most one doubleton

  public void testBalancedHand() {
    Hand h = new Hand("A,K,4,3", "K,J,9,2", "6,2", "Q,9,7");
    PointCalculator pc = new PointCalculator(h);
    assertTrue(pc.isBalanced());
  }
View Full Code Here

    PointCalculator pc = new PointCalculator(h);
    assertTrue(pc.isBalanced());
  }

  public void testImbalancedHandTwoDoubletons() {
    Hand h = new Hand("A,K,4,3", "K,J,9,7,2", "6,2", "Q,9");
    PointCalculator pc = new PointCalculator(h);
    assertFalse(pc.isBalanced());
  }
View Full Code Here

    PointCalculator pc = new PointCalculator(h);
    assertFalse(pc.isBalanced());
  }

  public void testImbalancedHandSingleton() {
    Hand h = new Hand("A,K,4,3", "K,J,9,2", "6", "Q,9,7,3");
    PointCalculator pc = new PointCalculator(h);
    assertFalse(pc.isBalanced());
  }
View Full Code Here

    PointCalculator pc = new PointCalculator(h);
    assertFalse(pc.isBalanced());
  }

  public void testImbalancedHandVoid() {
    Hand h = new Hand("A,K,Q,9,7,4,3", "K,J,9,2", "6,2");
    PointCalculator pc = new PointCalculator(h);
    assertFalse(pc.isBalanced());
  }
View Full Code Here

    assertFalse(pc.isBalanced());
  }

  //almost balanced hand patterns such as 4-4-4-1, 5-4-2-2, 5-4-3-1, 6-3-2-2 and 6-3-3-1 shape
  public void testTameHand_4_4_4_1() {
    Hand h = new Hand("A,K,4,3", "K,J,9,2", "2", "Q,9,7,6");
    PointCalculator pc = new PointCalculator(h);
    assertTrue(pc.isTame());
  }
View Full Code Here

    PointCalculator pc = new PointCalculator(h);
    assertTrue(pc.isTame());
  }

  public void testTameHand_4_4_4_1_ignoreOrder() {
    Hand h = new Hand("2", "A,K,4,3", "K,J,9,2", "Q,9,7,6");
    PointCalculator pc = new PointCalculator(h);
    assertTrue(pc.isTame());
  }
View Full Code Here

TOP

Related Classes of org.gnubridge.core.Hand

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.