Beispiel #1
0
        protected virtual void ProcessPlayersForRound(Streets street, int fromPlayer, int toPlayer)
        {
            if (fromPlayer <= toPlayer)
            {
                for (int playerIndex = fromPlayer; playerIndex <= toPlayer; playerIndex++)
                {
                    // Check if non empty bettinground for that player exists in the current round
                    IAquiredPokerPlayer aquiredPlayer = _aquiredHand[playerIndex];

                    if (aquiredPlayer.Count > (int)street && aquiredPlayer[street].Actions.Count > ActionCount)
                    {
                        ProcessRound(street, aquiredPlayer[street], _convertedHand[playerIndex]);
                    }
                }
            }
            else
            {
                // Headsup Postflop
                for (int playerIndex = fromPlayer; playerIndex >= toPlayer; playerIndex--)
                {
                    // Check if non empty bettinground for that player exists in the current round
                    IAquiredPokerPlayer aquiredPlayer = _aquiredHand[playerIndex];

                    if (aquiredPlayer.Count > (int)street && aquiredPlayer[street].Actions.Count > ActionCount)
                    {
                        ProcessRound(street, aquiredPlayer[street], _convertedHand[playerIndex]);
                    }
                }
            }
        }
Beispiel #2
0
        int AddPlayersToHandAndGetSmallBlindPosition(string smallBlindPlayerName)
        {
            int smallBlindPosition = 0;
            int relativeSeatNumber = 0;

            foreach (KeyValuePair <int, PlayerSeatsParser.PlayerData> playerSeat in PlayerSeatsParser.PlayerSeats)
            {
                IAquiredPokerPlayer aquiredPlayer = _aquiredPlayerMake.New
                                                    .InitializeWith(playerSeat.Value.Name, playerSeat.Value.Stack);

                aquiredPlayer.RelativeSeatNumber = relativeSeatNumber;
                aquiredPlayer.SeatNumber         = playerSeat.Key;

                if (aquiredPlayer.Name == smallBlindPlayerName)
                {
                    smallBlindPosition = aquiredPlayer.RelativeSeatNumber;
                }

                AquiredPokerHand.AddPlayer(aquiredPlayer);

                relativeSeatNumber++;
            }

            return(smallBlindPosition);
        }
Beispiel #3
0
        void ParseRiver(IAquiredPokerPlayer aquiredPlayer)
        {
            IAquiredPokerRound aquiredRound = GetPlayerActionsFor(StreetsParser.River, aquiredPlayer.Name);

            if (aquiredRound.Actions.Count > 0)
            {
                aquiredPlayer.AddRound(aquiredRound);
            }
        }
        static IAquiredPokerPlayer CreatePostingPlayer(string someName, double postedAmount)
        {
            IAquiredPokerPlayer aquiredPlayer = CreateAquiredPlayer(someName);
            var round = new AquiredPokerRound();

            round.Add(new AquiredPokerAction(ActionTypes.P, postedAmount));
            aquiredPlayer.AddRound(round);

            return(aquiredPlayer);
        }
        static IAquiredPokerPlayer CreateNonPostingActivePlayer(string someName, ActionTypes action, double ratio)
        {
            IAquiredPokerPlayer aquiredPlayer = CreateAquiredPlayer(someName);
            var round = new AquiredPokerRound();

            round.Add(new AquiredPokerAction(action, ratio));
            aquiredPlayer.AddRound(round);

            return(aquiredPlayer);
        }
        public void RemovePostingActionsAndCalculatePotAfterPosting_OneInactivePostingPlayer_RemovesPlayerFromHand()
        {
            const double        postedAmount  = 1.0;
            IAquiredPokerPlayer postingPlayer = CreatePostingPlayer("someName", postedAmount);

            _aquiredHand.AddPlayer(postingPlayer);

            _converter.CallRemovePostingActionsAndCalculatePotAfterPosting(ref _aquiredHand);

            bool playerWasRemoved = !_aquiredHand.Players.Contains(postingPlayer);

            Assert.That(playerWasRemoved);
        }
        RemovePostingActionsAndCalculatePotAfterPosting_OneActivePostingPlayer_RemovesPostingActionFromPlayer()
        {
            const double        postedAmount  = 1.0;
            IAquiredPokerPlayer postingPlayer = CreatePostingPlayer("someName", postedAmount);

            postingPlayer[Streets.PreFlop].Add(new AquiredPokerAction(ActionTypes.F, 1.0));
            _aquiredHand.AddPlayer(postingPlayer);

            _converter.CallRemovePostingActionsAndCalculatePotAfterPosting(ref _aquiredHand);

            bool firstActionIsNotPostingAction = !postingPlayer[Streets.PreFlop][0].What.Equals(ActionTypes.P);

            Assert.That(firstActionIsNotPostingAction);
        }
Beispiel #8
0
        public int CompareTo(IAquiredPokerPlayer other)
        {
            if (Position < other.Position)
            {
                return(-1);
            }

            if (Position > other.Position)
            {
                return(1);
            }

            return(0);
        }
Beispiel #9
0
        void ParseTurnAndRiver(IAquiredPokerPlayer aquiredPlayer)
        {
            IAquiredPokerRound aquiredRound = GetPlayerActionsFor(StreetsParser.Turn, aquiredPlayer.Name);

            if (aquiredRound.Actions.Count > 0)
            {
                aquiredPlayer.AddRound(aquiredRound);
            }

            // The only reason to parse River if no Turn actions were found, is to find eventual Winning Actions
            if (StreetsParser.HasRiver)
            {
                ParseRiver(aquiredPlayer);
            }
        }
 /// <summary>
 /// Method to add a player to the hand
 /// This version is used by the Parser and when importing a hand from Poker Office
 /// </summary>
 /// <param name="aquiredPlayer">Poker Player</param>
 public IAquiredPokerHand AddPlayer(IAquiredPokerPlayer aquiredPlayer)
 {
     _players.Add(aquiredPlayer);
     return(this);
 }
 /// <summary>
 /// Remove a Poker Player
 /// Needed when converting hand
 /// </summary>
 /// <param name="thePlayer">Player to remove</param>
 /// <returns>true if player could be removed</returns>
 public bool RemovePlayer(IAquiredPokerPlayer thePlayer)
 {
     return(_players.Remove(thePlayer));
 }