Package org.gnubridge.core

Examples of org.gnubridge.core.Hand


      Hand h = new Hand ("6,5,4", "10,9,8,7,2", "7,6,3,2","9" );
      PointCalculator pc = new ResponseCalculator(h, new Bid(1, Spades.i()));
      assertEquals(2, pc.getCombinedPoints());
    }
    public void testVoid() {
      Hand h = new Hand ("", "10,9,8,7,2", "7,6,2","10,9,8,7,6" );
      PointCalculator pc = new ResponseCalculator(h, new Bid(1, Hearts.i()));
      assertEquals(5, pc.getCombinedPoints());
    }
View Full Code Here


      Hand h = new Hand ("", "10,9,8,7,2", "7,6,2","10,9,8,7,6" );
      PointCalculator pc = new ResponseCalculator(h, new Bid(1, Hearts.i()));
      assertEquals(5, pc.getCombinedPoints());
    }
    public void testDoNotCountDistributionalPointsInPartnersColor() {
      Hand h = new Hand ("", "10,9,8,7,2", "7,6,2","10,9,8,7,6" );
      PointCalculator pc = new ResponseCalculator(h, new Bid(1, Spades.i()));
      assertEquals(0, pc.getCombinedPoints());
    }
View Full Code Here

    assertEquals(bid, agent.getBid());

  }

  protected void andPlayersCards(String... cardsBySuits) {
    agent = new BiddingAgent(auctioneer, new Hand(cardsBySuits));

  }
View Full Code Here

  }

  protected void givenPlayersCards(String... cardsBySuits) {
    givenNoPriorBids();
    agent = new BiddingAgent(auctioneer, new Hand(cardsBySuits));

  }
View Full Code Here

  }

  private static Deal constructGame() {
    Deal game = new Deal(NoTrump.i());
    game.getWest().init(new Hand("", "8", "", ""));
    game.getNorth().init(new Hand("3", "", "", ""));
    game.getEast().init(new Hand("A", "", "", ""));
    game.getSouth().init(new Hand("", "", "", "3"));
    game.setNextToPlay(Direction.EAST_DEPRECATED);
    return game;
  }
View Full Code Here

      Auctioneer a = new Auctioneer(West.i());
      Deal g = new Deal(null);
      GameUtils.initializeRandom(g, 13);
      g.printHandsDebug();
      while (!a.biddingFinished()) {
        Hand hand = new Hand(g.getPlayer(a.getNextToBid()).getHand());
        BiddingAgent baUnderTest = new BiddingAgent(a, hand);
        System.out.println(" for player: " + a.getNextToBid());
        System.out.println(" the recommended bid is: " + baUnderTest.getBid());
        List<Bid> validBids = getValidBids(a);
        assertTrue("no valid bids, but auction not finished", validBids.size() > 0);
View Full Code Here

    for (int i = 0; i < 100; i++) {
      MainController mainController = makeController();
      Auctioneer auction = mainController.getBiddingController().getAuction();
      System.out.println(" ** ( " + i + " )*** Automated bidding on a random game *****");
      mainController.getBiddingController().getCardHolder().printHandsDebug();
      Hand humanHand = new Hand(mainController.getBiddingController().getHuman().getHand());
      BiddingAgent humanAgent = new BiddingAgent(auction, humanHand);
      System.out.println("  Initial Calls: " + auction.getCalls());

      while (!auction.biddingFinished()) {

View Full Code Here

  protected Deal deal;
  protected DoubleDummySolver solver;

  public void given(Direction playerDirection, String... suits) {
    givenDeal();
    deal.getPlayer(playerDirection).init(new Hand(suits).getCardsHighToLow());

  }
View Full Code Here

  }

  public void testDoNotCountCurrentTrickAsPlayedCardWhenPruningPlayedSequence() {
    Node node = new Node(null);
    Deal game = new Deal(NoTrump.i());
    game.getPlayer(Direction.NORTH_DEPRECATED).init(new Hand("10,6", "", "", ""));
    game.getPlayer(Direction.EAST_DEPRECATED).init(new Hand("9,J", "", "", ""));
    game.setNextToPlay(Direction.NORTH_DEPRECATED);
    game.play(Ten.of(Spades.i()));
    DoubleDummySolver s = new DoubleDummySolver(game);
    s.examinePosition(node);
    assertEquals(2, s.getStack().size());
View Full Code Here

  // this pruning disabled for now
  public void _testOnlyExpandFirstCardInSequenceCardPlayedBetweenTwoUnplayedCards() {
    Node node = new Node(null);
    Deal game = new Deal(NoTrump.i());
    game.getPlayer(Direction.WEST_DEPRECATED).init(new Hand("", "", "4,3,2", ""));
    game.getPlayer(Direction.NORTH_DEPRECATED).init(new Hand("K,10,3", "", "", ""));
    game.getPlayer(Direction.EAST_DEPRECATED).init(new Hand("Q,A,2", "", "", ""));
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(new Hand("", "4,3,2", "", ""));
    game.setNextToPlay(Direction.NORTH_DEPRECATED);
    game.play(King.of(Spades.i()));
    game.play(Two.of(Spades.i()));
    game.play(Two.of(Hearts.i()));
    game.play(Two.of(Diamonds.i())); //north takes trick
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.