Beispiel #1
0
 public static bool operator <=(Bid b1, string b2)
 {
     return(b1 <= Bid.C(b2));
 }
Beispiel #2
0
 public bool compare(Bid other)
 {
     return(true);
 }
Beispiel #3
0
 public Contract(Bid b, bool d, bool r, Seats de, bool v)
 {
     theBid = b; _doubled = d; _redoubled = r; _declarer = de;
     this.theVulnerability = v ? Vulnerable.Both : Vulnerable.Neither;
     //declarerTricks = 0; defenseTricks = 0;
 }
Beispiel #4
0
 public Contract(Bid b, bool d, bool r, Seats declarer, Vulnerable v)
 {
     theBid = b; _doubled = d; _redoubled = r; _declarer = declarer;
     this.theVulnerability = v;
     //declarerTricks = 0; defenseTricks = 0;
 }
 public virtual void HandleExplanationDone(Seats source, Bid bid)
 {
 }
Beispiel #6
0
 public string ToXML() { return Bid.ToXML() + (Doubled ? "x" : "") + (Redoubled ? "x" : ""); }
 public virtual void HandleBidDone(Seats source, Bid bid)
 {
 }
 public virtual void HandleExplanationNeeded(Seats source, Bid bid)
 {
 }
Beispiel #9
0
 public abstract Bid FindBid(Bid lastRegularBid, bool allowDouble, bool allowRedouble);
 public virtual void HandleBidNeeded(Seats whoseTurn, Bid lastRegularBid, bool allowDouble, bool allowRedouble)
 {
 }
 public override void HandleBidDone(Seats source, Bid bid)
 {
     base.HandleBidDone(source, bid);
     this.CurrentResult.HandleBidDone(source, bid);
 }
 public override void HandleBidNeeded(Seats whoseTurn, Bid lastRegularBid, bool allowDouble, bool allowRedouble)
 {
     base.HandleBidNeeded(whoseTurn, lastRegularBid, allowDouble, allowRedouble);
     this.CurrentResult.HandleBidNeeded(whoseTurn, lastRegularBid, allowDouble, allowRedouble);
 }
Beispiel #13
0
 public int WanneerGeboden(string bidToFind)
 {
     return(WanneerGeboden(Bid.C(bidToFind)));
 }
Beispiel #14
0
 public void Record(Bid bid)
 {
     this.Record(this.WhoseTurn, bid);
 }
Beispiel #15
0
        //    /// <summary>Indexer that returns an AuctionItem</summary>
        //    /// <param name="index">int index</param>
        //    /// <value>?</value>
        //    public new AuctionItem this[int index]
        //    {
        //      get { return (AuctionItem)base[index]; }
        //      set { base[index] = value; }
        //    }

        /// <summary>Add an AuctionItem to the auction</summary>
        /// <param name="seat">The seat that made the bid</param>
        /// <param name="bid">The bid that has been made</param>
        public void Record(Seats seat, Bid bid)
        {
            if (bid == null)
            {
                throw new ArgumentNullException("bid");
            }
            if (bid.Index > 37)
            {
                throw new AuctionException("Unknown bid: {0}", bid.Index);
            }
            if (bid.IsDouble && !this.AllowDouble)
            {
                throw new AuctionException("Double not allowed");
            }
            if (bid.IsRedouble && !this.AllowRedouble)
            {
                throw new AuctionException("Redouble not allowed");
            }
            if (bid.IsRegular && this.lastBid >= bid)
            {
                throw new AuctionException("Bid {0} is too low", bid);
            }
            if (this.Ended)
            {
                throw new AuctionException("Auction has already ended");
            }
            if (seat != this.WhoseTurn)
            {
                throw new AuctionException(string.Format("Expected a bid from {0} instead of {1}", this.WhoseTurn, seat));
            }

            this.Bids.Add(bid);

            if (bid.IsPass)
            {
                this.passCount--;
                if (this.Ended)
                {
                }
            }
            else
            {
                this.passCount = 3;
                if (this.allPassesTillNow)
                {
                    this.allPassesTillNow   = false;
                    this.firstSeatNotToPass = seat;
                }
            }

            if (bid.IsRegular)
            {
                this.doubled   = false;
                this.redoubled = false;
                this.lastBid   = bid;
            }
            else
            {
                if (bid.IsDouble)
                {
                    this.doubled = true;
                }
                else
                {
                    if (bid.IsRedouble)
                    {
                        this.redoubled = true;
                    }
                }
            }
        }