// Methods /// <summary> /// Acts as the driver of the rounds. Essentially all of the businesses logic behind a round. /// </summary> /// <param name="roundParticipants"></param> /// <param name="ls"></param> /// <param name="roundNumber"></param> public void RunRound(IEnumerable <PlayerModel> roundParticipants, LoanShark ls, int roundNumber) { LoanShark = ls; List <PlayerModel> playersInRound = new List <PlayerModel>(); playersInRound.AddRange(roundParticipants); _dealer.PopulateDeck(); _dealer.ShuffleDeck(); PayAntes(playersInRound); _betToMatch = _ante; PlayerModel.SetOtherPlayersBets(_betToMatch); foreach (var p in playersInRound) { _dealer.DealPlayerCards(p); } int flips = 0; do { int cardsToDraw; if (flips == 0) { cardsToDraw = 3; DrawCommunityCards(cardsToDraw); } else { cardsToDraw = 1; DrawCommunityCards(cardsToDraw); } BettingCycle(playersInRound, flips); playersInRound.RemoveAll(player => player.PlayersDecision == DecisionType.Fold); flips++; } while (flips < 3 && playersInRound.Count() > 1); _roundWinners = GetWinner(playersInRound); DistributeWinnings(_roundWinners); DeleteHands(playersInRound); DeletePlayerCommCards(); _commCards.Clear(); }
public void NextRound(double v, LoanShark loanShark, int roundNumber) { var nextRound = new Round(v); nextRound.RunRound(Players, loanShark, roundNumber); }