private void Play() { DealFirstHoleCardForEachPlayer(); DealSecondHoleCardForEachPlayer(); SendHoleCardsToEachPlayer(); IList <ICard> communityCards = DealFlop(); callbacksHandler.SendFlopToAllPlayers(communityCards); var turn = deck.Deal(); communityCards.Add(turn); callbacksHandler.SendTurnToAllPlayers(turn); var river = deck.Deal(); communityCards.Add(river); callbacksHandler.SendRiverToAllPlayers(river); var investigator = builder.CreateNewHandInvestigator(); var bestHands = new Dictionary <Guid, IBestPossibleHand>(); foreach (var player in players) { var result = investigator.LocateBestHand(new List <ICard> { player.Value.FirstHoleCard, player.Value.SecondHoleCard }, communityCards); bestHands.Add(player.Key, result); callbacksHandler.SendMessageToPlayer(player.Key, result.ToString()); } Dictionary <Guid, IPlayerHoleCards> playerHoleCards = CreatePlayerHoleCards(); var comparer = builder.CreateNewHandComparer(); var winners = comparer.FindRoundWinners(playerHoleCards, communityCards); callbacksHandler.SendRoundResultsToAllPlayers(winners, bestHands); }
public void Initialize() { texasHoldEmBuilder = new TexasHoldEmEngineBuilder(); investigator = texasHoldEmBuilder.CreateNewHandInvestigator(); }