Skip to content

Commit

Permalink
Merge pull request #95 from ItalyToast/gg-small-fixes
Browse files Browse the repository at this point in the history
GGPoker small fixes
  • Loading branch information
ItalyToast authored Dec 5, 2023
2 parents f5b8347 + 0a30fa4 commit 4a128a5
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@
<None Update="SampleHandHistories\GGPoker\CashGame\GeneralHands\Straddle.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="SampleHandHistories\GGPoker\CashGame\Limits\Limit1.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleHandHistories\IGT\CashGame\ExtraHands\IGT2019Hand.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace HandHistories.Parser.UnitTests.Parsers.HandSummaryParserTests.Limits
[TestFixture("WinningPokerV2", new string[] { "$0.50-$1" })]
[TestFixture("BossMedia", new string[] { "$100-$200", "$5-$10", "$0.02-$0.04" })]
[TestFixture("IGT", new string[] { "SEK0.25-SEK0.50", "SEK10-SEK20" })]
[TestFixture("GGPoker", new string[] { "$0.50-$1" })]
class HandParserLimitTests_CashGame : HandParserLimitTests
{
public HandParserLimitTests_CashGame(string site, params string[] expectedLimits)
Expand All @@ -49,6 +50,7 @@ public void ParseLimit_AnteTable_Correct()
case SiteName.BossMedia:
case SiteName.OnGameIt:
case SiteName.IGT:
case SiteName.GGPoker:
Assert.Ignore(Site.ToString() + " doesn't have ante tables.");
break;

Expand Down Expand Up @@ -76,6 +78,7 @@ public void ParseLimit_EuroTable_Correct()
case SiteName.BossMedia:
case SiteName.OnGame:
case SiteName.IGT:
case SiteName.GGPoker:
Assert.Ignore("Site doesn't have euro tables ( example ).");
break;
case SiteName.Entraction:
Expand Down Expand Up @@ -106,6 +109,7 @@ public void ParseLimit_GbpTable_Correct()
case SiteName.BossMedia:
case SiteName.OnGameIt:
case SiteName.IGT:
case SiteName.GGPoker:
Assert.Ignore("Site doesn't have euro tables.");
break;
default:
Expand Down Expand Up @@ -133,6 +137,7 @@ public void ParseLimit_YuanTable_Correct()
case SiteName.BossMedia:
case SiteName.OnGameIt:
case SiteName.IGT:
case SiteName.GGPoker:
Assert.Ignore("Site doesn't have yuan tables.");
break;
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Poker Hand #HD23847510: Hold'em No Limit ($0.5/$1) - 2017/11/12 11:43:27
Poker Hand #HD23847510: Hold'em No Limit ($0.5/$1) - 2017/11/12 11:43:27
Table 'NLHGold11' 6-max Seat #2 is the button
Seat 1: 79adcegg ($173.04 in chips)
Seat 2: 853aak6d ($100 in chips)
Expand Down Expand Up @@ -27,4 +27,4 @@ Seat 1: 79adcegg folded before Flop (didn't bet)
Seat 2: 853aak6d (button) folded before Flop (didn't bet)
Seat 4: ac12334d (small blind) collected ($2)
Seat 5: 1234gsaa (big blind) folded before Flop
Seat 6: Hero folded before Flop (didn't bet)
Seat 6: Hero folded before Flop (didn't bet)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Poker Hand #OM2268205: PLO ($0.05/$0.1) - 2023/11/01 17:53:18
Table 'PLOBlue21' 6-max Seat #1 is the button
Seat 1: 7d288c5d ($10.68 in chips)
Seat 4: c1d29c12 ($11.32 in chips)
Seat 5: Hero ($10 in chips)
c1d29c12: posts small blind $0.05
Hero: posts big blind $0.1
*** HOLE CARDS ***
Dealt to 7d288c5d
Dealt to c1d29c12
Dealt to Hero [6h 6c 6s 9d]
7d288c5d: raises $0.25 to $0.35
c1d29c12: calls $0.3
Hero: folds
*** FLOP *** [3c 9s 2s]
c1d29c12: checks
7d288c5d: checks
*** TURN *** [3c 9s 2s] [4s]
c1d29c12: checks
7d288c5d: checks
*** RIVER *** [3c 9s 2s 4s] [Tc]
c1d29c12: checks
7d288c5d: checks
c1d29c12: shows [2h 8d Kh Ac] (Pair of Twos)
7d288c5d: shows [8c Kc 8h 9h] (Pair of Nines)
*** SHOWDOWN ***
7d288c5d collected $0.76 from pot
*** SUMMARY ***
Total pot $0.8 | Rake $0.04 | Jackpot $0 | Bingo $0 | Fortune $0 | Tax $0
Board [3c 9s 2s 4s Tc]
Seat 1: 7d288c5d (button) showed [8c Kc 8h 9h] and won ($0.76) with Pair of Nines
Seat 4: c1d29c12 (small blind) showed [2h 8d Kh Ac] and lost with Pair of Twos
Seat 5: Hero (big blind) folded before Flop
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Poker Hand #HD1412421: Hold'em No Limit ($0.5/$1) - 2020/01/12 11:17:37
Table 'NLHGold3' 6-max Seat #6 is the button
Seat 1: 1476ab3d ($50.5 in chips)
Seat 2: x413dcda ($17.34 in chips)
Seat 3: xca591ab ($100 in chips)
Seat 4: Hero ($78 in chips)
Seat 5: 90badc41 ($100.28 in chips)
Seat 6: c32avd12 ($5.84 in chips)
1476ab3d: posts small blind $0.5
x413dcda: posts big blind $1
*** HOLE CARDS ***
Dealt to 1476ab3d
Dealt to x413dcda
Dealt to xca591ab
Dealt to Hero [2c 3h]
Dealt to 90badc41
Dealt to c32avd12
xca591ab: raises $1 to $2
Hero: folds
90badc41: folds
c32avd12: folds
1476ab3d: folds
x413dcda: folds
Uncalled bet ($1) returned to xca591ab
*** SHOWDOWN ***
xca591ab collected $2.5 from pot
*** SUMMARY ***
Total pot $2.5 | Rake $0 | Jackpot $0 | Bingo $0 | Fortune $0 | Tax $0
Seat 1: 1476ab3d (small blind) folded before Flop
Seat 2: x413dcda (big blind) folded before Flop
Seat 3: xca591ab collected ($2.5)
Seat 4: Hero folded before Flop (didn't bet)
Seat 5: 90badc41 folded before Flop (didn't bet)
Seat 6: c32avd12 (button) folded before Flop (didn't bet)
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ namespace HandHistories.Parser.Parsers.FastParser.GGPoker

public partial class GGPokerFastParserImpl : HandHistoryParserFastImpl, IThreeStateParser
{
static readonly TimeZoneInfo PokerStarsTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");

public override bool RequiresAdjustedRaiseSizes => true;

public override bool SupportRunItTwice => true;
Expand All @@ -38,9 +36,7 @@ public partial class GGPokerFastParserImpl : HandHistoryParserFastImpl, IThreeSt

private readonly NumberFormatInfo _numberFormatInfo;

private readonly Regex _handSplitRegex;

private readonly String _summarySeperator = " | ";
private static readonly Regex _handSplitRegex = new Regex("Poker Hand #", RegexOptions.Compiled);

public GGPokerFastParserImpl()
{
Expand All @@ -51,7 +47,6 @@ public GGPokerFastParserImpl()
CurrencyGroupSeparator = ",",
CurrencySymbol = "$"
};
_handSplitRegex = new Regex("Poker Hand #", RegexOptions.Compiled);
}

public override IEnumerable<string> SplitUpMultipleHands(string rawHandHistories)
Expand Down Expand Up @@ -100,7 +95,7 @@ protected override void ParseExtraHandInformation(string[] handLines, HandHistor
// Total pot $1 | Rake $0.05 | Jackpot $0 | Bingo $0
if (line.StartsWithFast("Total pot"))
{
string[] breakdown = line.Split(_summarySeperator);
string[] breakdown = line.Split(" | ");
handHistorySummary.TotalPot = breakdown[0].Substring(10).ParseAmountWS();
handHistorySummary.Rake = breakdown[1].Substring(5).ParseAmountWS();
handHistorySummary.Jackpot = breakdown[2].Substring(8).ParseAmountWS();
Expand Down Expand Up @@ -319,9 +314,7 @@ protected override long[] ParseHandId(string[] handLines)
// Poker Hand #HD138495: Hold'em No Limit ($0.5/$1) - 2019/10/12 01:43:27
string line = handLines[0];
string id = line.Split(':')[0].Split(' ')[2].Substring(3);
long[] result = new long[1];
result[0] = (long)Convert.ToInt64(id);
return result;
return HandID.Parse(id);
}

protected override long ParseTournamentId(string[] handLines)
Expand All @@ -332,8 +325,10 @@ protected override long ParseTournamentId(string[] handLines)
protected override string ParseTableName(string[] handLines)
{
// Table 'NLHSilver5' 6-max Seat #2 is the button
string tableNameWithQuote = handLines[1].Split(' ')[1];
return tableNameWithQuote.Substring(1, tableNameWithQuote.Length - 2);
var line = handLines[1];
var startIndex = line.IndexOf('\'') + 1;
var endIndex = line.IndexOf('\'', startIndex);
return line.SubstringBetween(startIndex, endIndex);
}

protected override PokerFormat ParsePokerFormat(string[] handLines)
Expand All @@ -359,8 +354,20 @@ protected override SeatType ParseSeatType(string[] handLines)

protected override GameType ParseGameType(string[] handLines)
{
// Only Holdem is supported for now.
return GameType.NoLimitHoldem;
var line = handLines[0];
var colonIndex = line.IndexOf(':', 12);

// can be either 1 or 2 spaces after the colon
var startIndex = colonIndex + 1;
var endIndex = line.IndexOf('(', colonIndex) - 1;

switch (line.SubstringBetween(startIndex, endIndex).Trim())
{
case "Hold'em No Limit": return GameType.NoLimitHoldem;
case "PLO": return GameType.PotLimitOmaha;
}

return GameType.Unknown;
}

protected override TableType ParseTableType(string[] handLines)
Expand Down Expand Up @@ -394,9 +401,11 @@ protected override Limit ParseLimit(string[] handLines)
// or

// Poker Hand #HD138495: Hold'em No Limit ($0.5/$1) - 2019/10/12 01:43:27
string stake = handLines[0].Split(' ')[7];
stake = stake.Substring(1, stake.Length - 2);
Currency currency = ParseCurrency(handLines[0], stake[0]);
var line = handLines[0];
var stakeStart = line.IndexOf('(', 12) + 1;
var stakeEnd = line.IndexOf(')', stakeStart);
string stake = line.SubstringBetween(stakeStart, stakeEnd);
Currency currency = ParseCurrency(line, stake[0]);

int slashIndex = stake.IndexOf('/');
string smallBlind = stake.Substring(0, slashIndex);
Expand Down Expand Up @@ -442,7 +451,6 @@ protected override List<HandAction> ParseHandActions(string[] handLines, GameTyp
ParseShowDown(handLines, handActions, winners, actionIndex, gameType);

return handActions;

}

protected override PlayerList ParsePlayers(string[] handLines)
Expand Down

0 comments on commit 4a128a5

Please sign in to comment.