Package org.gnubridge.core.bidding

Examples of org.gnubridge.core.bidding.PointCalculator


  private final PointCalculator calculator;

  public OvercallSuit(Auctioneer a, Hand h) {
    super(a, h);
    calculator = new PointCalculator(hand);
  }
View Full Code Here


  private PointCalculator pc;

  public Open1NT(Auctioneer a, Hand h) {
    super(a, h);
    pc = new PointCalculator(hand);
  }
View Full Code Here

  private final PointCalculator pc;

  public Overcall1NT(Auctioneer a, Hand h) {
    super(a, h);
    pc = new PointCalculator(hand);
  }
View Full Code Here

    return super.applies() && auction.isOvercall(partnersOpeningBid) && partnersOpeningBid.getTrump().isSuit();
  }

  @Override
  protected Bid prepareBid() {
    PointCalculator calculator = new ResponseCalculator(hand, partnersOpeningBid);
    if (hand.getSuitLength(partnersOpeningBid.getTrump().asSuit()) >= 3) {
      if (calculator.getCombinedPoints() >= 8 && calculator.getCombinedPoints() <= 11) {
        return new Bid(partnersOpeningBid.getValue() + 1, partnersOpeningBid.getTrump());
      }
      if (calculator.getCombinedPoints() >= 12 && calculator.getCombinedPoints() <= 14) {
        return new Bid(partnersOpeningBid.getValue() + 2, partnersOpeningBid.getTrump());
      }
      if (calculator.getCombinedPoints() >= 15) { //Pavlicek is unclear in lesson 7, see tests && partnersOpeningBid.getTrump().isMajorSuit()) {
        return new Bid(MAJOR_SUIT_GAME, partnersOpeningBid.getTrump());
      }

    }
    List<Suit> suitsWithAtLeast5Cards = hand.getSuitsWithAtLeastCards(5);
    if (suitsWithAtLeast5Cards.size() > 0) {
      Suit highestSuitWithAtLeast5Cards = suitsWithAtLeast5Cards.get(0).asSuit();
      if (calculator.getCombinedPoints() >= 8 && calculator.getCombinedPoints() <= 11) {
        return makeCheapestBid(highestSuitWithAtLeast5Cards);
      }
      if (calculator.getCombinedPoints() >= 12 && calculator.getCombinedPoints() <= 14) {
        Bid bid = makeCheapestBid(highestSuitWithAtLeast5Cards);
        return new Bid(bid.getValue() + 1, highestSuitWithAtLeast5Cards);
      }
      if (calculator.getCombinedPoints() >= 15) { //Pavlicek is unclear in lesson 7, see tests && highestSuitWithAtLeast5Cards.isMajorSuit()) {
        return new Bid(MAJOR_SUIT_GAME, highestSuitWithAtLeast5Cards);
      }
    }

    if (haveStopperInEnemySuit()) {
      if (calculator.getCombinedPoints() >= 8 && calculator.getCombinedPoints() <= 11) {
        return makeCheapestBid(NOTRUMP);
      }
      if (calculator.getCombinedPoints() >= 12 && calculator.getCombinedPoints() <= 14) {
        Bid bid = makeCheapestBid(NOTRUMP);
        return new Bid(bid.getValue() + 1, NOTRUMP);
      }
      if (calculator.getCombinedPoints() >= 15) {
        return new Bid(NOTRUMP_GAME, NOTRUMP);
      }
    }
    return null;
  }
View Full Code Here

  private final PointCalculator pc;

  public Respond1NT(Auctioneer a, Hand h) {
    super(a, h);
    pc = new PointCalculator(hand);
  }
View Full Code Here

  private PointCalculator pc;

  public Open1Color(Auctioneer a, Hand h) {
    super(a, h);
    pc = new PointCalculator(hand);
  }
View Full Code Here

  @Override
  protected boolean applies() {
    boolean result = false;
    if (super.applies()) {
      calculator = new PointCalculator(hand);
      if (partnersOpeningBid.getTrump().isSuit() && partnersOpeningBid.getValue() == 1
          && calculator.getHighCardPoints() >= 6) {
        result = true;
      }
    }
View Full Code Here

  }

  @Override
  protected Bid prepareBid() {
    if (hand.getSuitLength(opening.getTrump().asSuit()) >= 6) {
      int combinedPoints = new PointCalculator(hand).getCombinedPoints();
      if (combinedPoints <= 15) {
        return new Bid(2, opening.getTrump());
      }
      if (combinedPoints >= 16 && combinedPoints <= 18) {
        return new Bid(3, opening.getTrump());
View Full Code Here

  }

  @Override
  protected Bid prepareBid() {
    Bid result = null;
    PointCalculator pc = new PointCalculator(hand);
    if (response.getTrump().isNoTrump()) {
      if (pc.getHighCardPoints() >= 19 && (pc.isTame() || pc.isBalanced())) {
        result = new Bid(3, NoTrump.i());
      } else if (pc.getHighCardPoints() >= 16 && pc.isTame()) {
        result = new Bid(2, NoTrump.i());
      }
    } else if (pc.isBalanced()) {
      if (pc.getHighCardPoints() >= 13 && pc.getHighCardPoints() <= 15) {
        result = new Bid(1, NoTrump.i());
      } else if (pc.getHighCardPoints() >= 19 && pc.getHighCardPoints() <= 20) {
        result = new Bid(2, NoTrump.i());
      }
    }
    return result;
  }
View Full Code Here

    return false;
  }

  @Override
  protected Bid prepareBid() {
    PointCalculator calculator = new PointCalculator(hand);
    int minimumBid = getMinimumBidInSuit(unbidSuit);
    if (calculator.getCombinedPoints() >= 19) {
      Bid bid = new Bid(minimumBid + 1, unbidSuit);
      bid.makeGameForcing();
      return bid;
    }
    if ((minimumBid == 2 && !calculator.isBalanced())) {
      if (calculator.getCombinedPoints() >= 16 || unbidSuit.isLowerRankThan(opening.getTrump())) {
        return new Bid(minimumBid, unbidSuit);
      }
    }
    if (minimumBid == 1) {
      return new Bid(minimumBid, unbidSuit);
View Full Code Here

TOP

Related Classes of org.gnubridge.core.bidding.PointCalculator

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.