Example #1
0
        public override async Task <Board2> GetNextBoardAsync(int boardNumber, Guid userId)
        {
            var c = new Board2(boardNumber);

            c.Distribution.DealRemainingCards(ShufflingRequirement.Random);
            return(c);
        }
Example #2
0
        private async Task NextBoard()
        {
            if (this.waiter == null)
            {
                throw new ArgumentNullException("waiter");
            }
            Log.Trace(3, "TournamentController.NextBoard start");
            this.boardNumber++;
            this.currentBoard = await this.currentTournament.GetNextBoardAsync(this.boardNumber, this.participant.UserId);

            if (this.currentBoard == null)
            {
                Log.Trace(2, "TournamentController.NextBoard no next board");
                this.EventBus.HandleTournamentStopped();
                //this.EventBus.Unlink(this);
                Log.Trace(5, "TournamentController.NextBoard after HandleTournamentStopped and before waiter.Release");
                this.waiter.Release();
                Log.Trace(5, "TournamentController.NextBoard after waiter.Release");
            }
            else
            {
                Log.Trace(1, "TournamentController.NextBoard board={0}", this.currentBoard.BoardNumber);
                this.EventBus.HandleBoardStarted(this.currentBoard.BoardNumber, this.currentBoard.Dealer, this.currentBoard.Vulnerable);
                foreach (var item in currentBoard.Distribution.Deal)
                {
                    this.EventBus.HandleCardPosition(item.Seat, item.Suit, item.Rank);
                }

                this.EventBus.HandleCardDealingEnded();
            }
        }
 public BoardResultRecorder(string _owner, Board2 board) : base()
 {
     //if (board == null) throw new ArgumentNullException("board");
     this.Board = board;
     this.Owner = _owner;
     if (board == null)
     {
         this.theDistribution = new Distribution();
     }
     else
     {
         this.theDistribution = board.Distribution.Clone();
     }
 }
Example #4
0
 public BoardResult(string _owner, Board2 board, Participant newParticipant)
     : this(_owner, board, newParticipant.Names)
 {
 }
Example #5
0
 public BoardResult(string _owner, Board2 board, SeatCollection <string> newParticipants) : base(_owner, board)
 {
     //if (board == null) throw new ArgumentNullException("board");
     this.Participants = new Participant(newParticipants);
 }
Example #6
0
 public BoardResultEventPublisher(string _owner, Board2 board, SeatCollection <string> newParticipants, BridgeEventBus bus, Tournament t)
     : base(_owner, board, newParticipants)
 {
     this.EventBus          = bus;
     this.currentTournament = t;
 }
Example #7
0
 internal void BoardChanged(Board2 p)
 {
     this.theDealer        = p.Dealer;
     this.theVulnerability = p.Vulnerable;
     this.contract         = null;
 }