private void CollectVPIPData(PlayerHandHistory phh) { if (phh.Actions.Exists(x => x.Round.Contains(HandActions.PreFlop) && !x.HandAction.Contains(HandActions.Fold))) { this.VPIPHands++; } }
private void Collect3BetPFData(PlayerHandHistory phh) { if (phh.Actions.Exists(x => x.Round.Contains(HandActions.PreFlop) && x.HandAction.Contains(HandActions.Raise) && x.RaiseCount == 3)) { this.ThreeBetPF++; } }
private void CollectPFRData(PlayerHandHistory phh) { if (phh.Actions.Exists(x => x.Round.Contains(HandActions.PreFlop) && x.HandAction.Contains(HandActions.Raise))) { this.PFRHands++; } }
private decimal GetHandWinnigs(PlayerHandHistory phh, decimal rake) { //TODO: Bug alert, idk how this handles split pots if (phh.Earnings > 0) { return(phh.Earnings - rake); } return(phh.Earnings); }
private IEnumerable <PlayerHandHistory> GetPlayersAndPositions(List <string> rawHand) { List <PlayerHandHistory> phh = new List <PlayerHandHistory>(); int playerStartLine = 2; int count = 0; string line = rawHand[playerStartLine + count]; string pattern = "Seat #\\d"; string match = Regex.Match(rawHand[1], pattern).Value; string buttonSeat = match.Replace("#", ""); int buttonPosition = 0; while (line.StartsWith("Seat ")) { // Get the player name string playerName = line.Substring(line.IndexOf(":") + 1, line.IndexOf("(") - line.IndexOf(":") - 1).Trim(); PlayerHandHistory p = new PlayerHandHistory(playerName); int moneyStart = line.IndexOf("($") + 2; int moneyEnd = line.IndexOf(" in chips)"); string moneyString = line.Substring(moneyStart, moneyEnd - moneyStart); decimal startMoney = Convert.ToDecimal(moneyString); p.StartMoney = startMoney; // get which player in the list is the button if (line.StartsWith(buttonSeat)) { buttonPosition = phh.Count(); } phh.Add(p); count++; line = rawHand[playerStartLine + count]; } GetPlayerPositions(ref phh, buttonPosition); GetHandActions(ref phh, rawHand); GetShowDownInfo(ref phh, rawHand); return(phh); }
public HUDStats(List <HandHistory> handHistories, string playerName) { this.handHistories = handHistories; foreach (HandHistory hh in handHistories) { PlayerHandHistory phh = hh.PlayerHandHistories.Where(x => x.PlayerName == playerName).SingleOrDefault(); if (!(phh is null)) { this.HandCount++; CollectVPIPData(phh); CollectPFRData(phh); CollectAFData(phh); Collect3BetPFData(phh); this.Winnings += GetHandWinnigs(phh, hh.Rake); } } this.AF = CalculateAF(); this.VPIP = CalculateVPIP(); this.PFR = CalculatePFR(); this.ThreeBetPF = Calculate3BetPF(); }
private void CollectAFData(PlayerHandHistory phh) { this.AggressiveCount += phh.Actions.Where(x => x.HandAction.Contains(HandActions.Bet) || x.HandAction.Contains(HandActions.Raise)).Count(); this.PassiveCount += phh.Actions.Where(x => x.HandAction.Contains(HandActions.Bet)).Count(); }