Beispiel #1
0
        /// <summary>
        /// Determines whether the argument bid is a higher bid than this one.
        /// </summary>
        /// <param name="newBid">The new bid.</param>
        /// <returns>
        ///   <c>true</c> if the argument bid is valid to succeed this; otherwise, <c>false</c>.
        /// </returns>
        public override bool IsHigherBid(Bid newBid)
        {
            if (newBid.BidType == Bridge.BidType.Redouble)
            {
                return true;
            }

            BidTrumph trumphBid = newBid as BidTrumph;
            return trumphBid != null && DoubledBid.IsHigherBid(trumphBid);
        }
Beispiel #2
0
        /// <summary>
        /// Determines whether the argument bid is a higher bid than this one.
        /// </summary>
        /// <param name="newBid">The new bid.</param>
        /// <returns>
        ///   <c>true</c> if the argument bid is valid to succeed this; otherwise, <c>false</c>.
        /// </returns>
        public override bool IsHigherBid(Bid newBid)
        {
            if(newBid == null)
            {
                throw new ArgumentNullException("newBid");
            }

            if (newBid.BidType == Bridge.BidType.Redouble)
            {
                return true;
            }

            return Doubled.IsHigherBid(newBid);
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlacedBid"/> class.
        /// </summary>
        public PlacedBid(Bid bid, IEnumerable<BidMeaning> meaning)
        {
            if (bid == null)
            {
                throw new ArgumentNullException("bid");
            }

            if (meaning == null)
            {
                throw new ArgumentNullException("meaning");
            }

            /* We'll not validate if the reason is defined. We'll leave that to the auction. */

            this.Bid = bid;
            this.Meaning = meaning.ToList();
        }
Beispiel #4
0
 /// <summary>
 /// Determines whether the argument bid is a higher bid than this one.
 /// </summary>
 /// <param name="newBid">The new bid.</param>
 /// <returns>
 ///   <c>true</c> if the argument bid is valid to succeed this; otherwise, <c>false</c>.
 /// </returns>
 public abstract bool IsHigherBid(Bid newBid);
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InvalidBidException"/> class.
 /// </summary>
 /// <param name="reason">The reason of the error.</param>
 /// <param name="bid">The bid that caused the error.</param>
 public InvalidBidException(string reason, Bid bid)
     : base(reason)
 {
     this.bid = bid;
 }
Beispiel #6
0
 /// <summary>
 /// Determines whether the argument bid is a higher bid than this one.
 /// </summary>
 /// <param name="newBid">The new bid.</param>
 /// <returns>
 ///   <c>true</c> if the argument bid is valid to succeed this; otherwise, <c>false</c>.
 /// </returns>
 public override bool IsHigherBid(Bid newBid)
 {
     return newBid.BidType == Bridge.BidType.Trick;
 }