Esempio n. 1
0
        public override string ToString()
        {
            string str = "";

            str += "VPIP: " + VPIP.ToString() + "\n";
            str += "PFR: " + PFR.ToString() + "\n";
            str += "WTP: " + WTP.ToString() + "\n";
            str += "Aggression: " + AGG.ToString() + "\n\n";

            return(str + paramsToString());
        }
 public VPIPCorrection(IStats playingStyle, int numberOfHandsToStartCorrection)
     : base(numberOfHandsToStartCorrection)
 {
     this.vpip = playingStyle.VPIP;
 }
Esempio n. 3
0
        public void increment(Hand hand)
        {
            Debug.Assert(hand.Client == Client);
            Debug.Assert(hand.PlayersNames.Count <= (int)_tableType);

            var allInList        = new List <string>();
            var activePlayerList = new List <string>(hand.PlayersNames);
            int playerIndex      = activePlayerList.FindIndex(name => name == PlayerName);

            if (playerIndex < 0)
            {
                return;
            }

            Position position            = getPlayerPosition(activePlayerList, PlayerName);
            var      lastPlayerAction    = ActionType.Fold;
            bool     playerPutMoneyInPot = false;
            bool     playerFoldedOrAllIn = false;

            // Pre-Flop
            {
                int numRaises  = 0;
                int numCallers = 0;

                foreach (Action a in hand.ActionList.Where(a => a.Street == Street.PreFlop && a.IsValidAction))
                {
                    if (playerFoldedOrAllIn || activePlayerList.Count <= 1)
                    {
                        break;
                    }

                    if (a.PlayerName == PlayerName)
                    {
                        int numPlayers = activePlayerList.Count + allInList.Count;

                        var preFlopParams = new PreFlopParams(_tableType,
                                                              position,
                                                              numCallers,
                                                              numRaises,
                                                              numPlayers,
                                                              lastPlayerAction,
                                                              inPosition(activePlayerList, a.PlayerName, numPlayers));

                        getPreFlopStats(preFlopParams).addSample(a.Type);

                        if (a.Type == ActionType.Fold || a.Type == ActionType.AllIn)
                        {
                            playerFoldedOrAllIn = true;
                        }

                        if (a.IsRaiseAction || a.Type == ActionType.Call)
                        {
                            playerPutMoneyInPot = true;
                        }

                        lastPlayerAction = a.Type;
                    }
                    else
                    {
                        if (a.Type == ActionType.Fold)
                        {
                            activePlayerList.Remove(a.PlayerName);
                        }
                        else if (a.Type == ActionType.AllIn)
                        {
                            activePlayerList.Remove(a.PlayerName);
                            allInList.Add(a.PlayerName);
                        }
                    }

                    if (a.IsRaiseAction)
                    {
                        numRaises++;
                        numCallers = 0;
                    }
                    else if (a.Type == ActionType.Call)
                    {
                        numCallers++;
                    }
                }
            }

            // VPIP
            VPIP.AddSample(playerPutMoneyInPot);

            // For each remaining streets
            for (var currentStreet = Street.Flop; currentStreet <= Street.River; currentStreet++)
            {
                if (playerFoldedOrAllIn || activePlayerList.Count <= 1)
                {
                    break;
                }

                int round     = 0;
                int numRaises = 0;

                // For each action on current street
                foreach (Action a in hand.ActionList.Where(a => (a.Street == currentStreet) && a.IsValidAction))
                {
                    if (a.PlayerName == PlayerName)
                    {
                        var numPlayers = activePlayerList.Count + allInList.Count;

                        var postFlopParams = new PostFlopParams(_tableType,
                                                                currentStreet,
                                                                round,
                                                                lastPlayerAction,
                                                                numRaises,
                                                                inPosition(activePlayerList, a.PlayerName, numPlayers),
                                                                numPlayers);

                        //round == 1 && lastPlayerAction == ActionType.Check && postFlopParams.InPosition == true
                        getPostFlopStats(postFlopParams).addSample(a.Type);

                        if (a.Type == ActionType.Fold || a.Type == ActionType.AllIn)
                        {
                            playerFoldedOrAllIn = true;
                            break;
                        }

                        lastPlayerAction = a.Type;
                        round++;
                    }
                    else
                    {
                        if (a.Type == ActionType.Fold)
                        {
                            activePlayerList.Remove(a.PlayerName);
                        }
                        else if (a.Type == ActionType.AllIn)
                        {
                            activePlayerList.Remove(a.PlayerName);
                            allInList.Add(a.PlayerName);
                        }
                    }

                    if (a.IsRaiseAction)
                    {
                        numRaises++;
                    }
                }
            }
        }