public override void HandleCardPlayed(Seats source, Suits suit, Ranks rank)
            {
#if syncTrace
                Log.Trace(4, "HostBoardResult.HandleCardPlayed {0} plays {2}{1}", source, suit.ToXML(), rank.ToXML());
#endif
                this.host.ThinkTime[source.Direction()].Stop();
                //this.host.boardTime[source.Direction()] = this.host.boardTime[source.Direction()].Add(timer.Elapsed.Subtract(new TimeSpan(this.host.clients[source].communicationLag)));
                base.HandleCardPlayed(source, suit, rank);
                for (Seats s = Seats.North; s <= Seats.West; s++)
                {
                    if ((s != source && !(s == this.Auction.Declarer && source == this.Play.Dummy)) ||
                        (s == source && source == this.Play.Dummy)
                        )
                    {
                        this.host.clients[s].WriteData("{0} plays {2}{1}", source, suit.ToXML(), rank.ToXML());
                    }

                    if (this.Play.currentTrick == 1 && this.Play.man == 2)
                    {   // 1st card: need to send dummies cards
#if syncTrace
                        //Log.Trace("HostBoardResult.HandleCardPlayed 1st card to {0}", s);
#endif
                        var mustPause = s == this.Play.Dummy;
                        lock (this.host.clients) this.host.clients[s].Pause = mustPause;
                        this.host.clients[s].state = s == this.Play.Dummy ? TableManagerProtocolState.GiveDummiesCards : TableManagerProtocolState.WaitForDummiesCards;
                    }
                }
            }
Esempio n. 2
0
        internal static string Translate(Seats s, Distribution d)
        {
            // "North's cards : S A K J 6.H A K J.D 8 6 2.C A 7 6."
            // Meadowlark expects ". " between suits
            var cards = string.Format("{0}'s cards : ", s.ToXMLFull());

            for (Suits suit = Suits.Spades; suit >= Suits.Clubs; suit--)
            {
                cards += suit.ToXML();
                for (Ranks rank = Ranks.Ace; rank >= Ranks.Two; rank--)
                {
                    if (d.Owns(s, suit, rank))
                    {
                        cards += " " + rank.ToXML();
                    }
                }
                cards += ".";
            }

            return(cards);
        }
        public override void HandleCardPlayed(Seats source, Suits suit, Ranks rank)
        {
            Log.Trace(4, "{3}.BoardResultRecorder.HandleCardPlayed: {0} played {2}{1}", source, suit.ToXML().ToLower(), rank.ToXML(), this.Owner);
            if (this.thePlay != null && this.theDistribution != null)
            {
                this.thePlay.Record(suit, rank);
                if (!this.theDistribution.Owns(source, suit, rank))
                {
                    //  throw new FatalBridgeException(string.Format("{0} does not own {1}", source, card));
                    /// 18-03-08: cannot check here: hosted tournaments get a card at the moment the card is played
                    this.Distribution.Give(source, suit, rank);
                }

                this.theDistribution.Played(source, suit, rank);
            }
        }
 public override void HandleCardPosition(Seats seat, Suits suit, Ranks rank)
 {
     if (this.theDistribution.Incomplete)
     {       // this should only happen in a hosted tournament
         Log.Trace(4, "{3}.BoardResultRecorder.HandleCardPosition: {0} gets {2}{1}", seat, suit.ToXML().ToLower(), rank.ToXML(), this.Owner);
         this.theDistribution.Give(seat, suit, rank);
     }
 }