示例#1
0
        public static GameState MakeBid(GameState gameState, PrivateAuctionRound round, PlayerState biddingPlayerState, PrivateCompany selection, int bid)
        {            
            if (round.CurrentAuction == null)
            {
                // No auction is in progress so start a new auction for the selected private 
                round = round.StartAuction(biddingPlayerState.Player, selection, bid);
            }
            else
            {
                // Apply the new bid to the current auction
                var newAuction = round.CurrentAuction.MakeBid(selection, biddingPlayerState.Player, bid);
                round = round.Update(auction: newAuction, activePlayer: newAuction.GetNextPlayer());
            }

            if (bid == selection.Value)
            {
                // Maximum bid was made, auction terminates                                
                return CompleteAuction(gameState, round);
            }

            return gameState.WithRound(round);
        }