Skip to content

Commit

Permalink
Initial Commit for our SVN/GIT Merge
Browse files Browse the repository at this point in the history
OnGame: Added few more required Timezones
PartyPoker: Updated RegexParser for Multicurrency/Multisite support
PartyPoker: Added PartyPokerNJ, PartyPokerES
GameTypeUtil: Added few new cases
PokerFormat: Added parser
PokerStars: Split ZOOM correctly + new TableType 'Deep'
  • Loading branch information
BewareOfWombat committed Mar 21, 2015
1 parent 225d18e commit 76a1874
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 29 deletions.
12 changes: 12 additions & 0 deletions HandHistories.Objects/GameDescription/GameTypeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static GameType ParseGameString(string gameString)
case "fl hold'em":
case "fixed holdem":
case "fixed hold'em":
case "limit hold'em":
return GameType.FixedLimitHoldem;
case "pl omaha":
case "plo":
Expand All @@ -42,7 +43,18 @@ public static GameType ParseGameString(string gameString)
case "plo hi-lo":
return GameType.PotLimitOmahaHiLo;
case "omaha hi-lo no limit":
case "no limit omaha hi-lo":
return GameType.NoLimitOmahaHiLo;
case "fl omaha hi-lo":
return GameType.FixedLimitOmahaHiLo;
case "fixed limit omaha":
return GameType.FixedLimitOmaha;
case "no limit omaha":
return GameType.NoLimitOmaha;
case "pot limit five card omaha hi-lo":
return GameType.FiveCardPotLimitOmahaHiLo;
case "pot limit five card omaha":
return GameType.FiveCardPotLimitOmaha;
default:
string match = Enum.GetNames(typeof(GameType)).FirstOrDefault(g => g.ToLower().Equals(gameString.ToLower()));
return match == null ? GameType.Unknown : (GameType)Enum.Parse(typeof(GameType), match,true);
Expand Down
27 changes: 27 additions & 0 deletions HandHistories.Objects/GameDescription/PokerFormatUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,32 @@ public static string GetDisplayName(PokerFormat pokerFormat)
return pokerFormat.ToString();
}
}

public static PokerFormat ParseFormatName(string pokerformat)
{
switch (pokerformat.ToLower())
{
case "cash game":
case "cashgame":
case "cg":
case "cash":
return PokerFormat.CashGame;

case "sng":
case "sitandgo":
case "sit and go":
case "sitngo":
case "sit&go":
return PokerFormat.SitAndGo;

case "mtt":
case "multitabletournament":
case "multi table tournament":
return PokerFormat.MultiTableTournament;

}

return PokerFormat.Unknown;
}
}
}
2 changes: 2 additions & 0 deletions HandHistories.Objects/GameDescription/SiteNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public enum SiteName : byte
PokerStarsZoom = 26,
Winamax = 27,
WinningPoker = 28,
PartyPokerNJ = 29,
PartyPokerEs = 30,
All = 63 // note: can't go higher than 63 due to bit value optimizations
}
}
16 changes: 16 additions & 0 deletions HandHistories.Objects/GameDescription/SiteUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public static string GetDisplaySiteName(SiteName siteName)
return "Poker Stars Fr";
case SiteName.PokerStarsEs:
return "Poker Stars Es";
case SiteName.IPoker:
return "iPoker";
case SiteName.IPoker2:
return "iPoker - Low";
default:
return siteName.ToString();
}
Expand Down Expand Up @@ -51,6 +55,9 @@ public static SiteName ParseSiteName(string site)
case "pty":
case "pp":
return SiteName.PartyPoker;
case "ipoker1":
case "ipoker-top":
case "ipoker - top":
case "ipoker":
case "titanpoker":
case "titan":
Expand All @@ -64,6 +71,7 @@ public static SiteName ParseSiteName(string site)
return SiteName.Cereus;
case "ongame":
case "on game":
case "bestpoker":
return SiteName.OnGame;
case "bodog":
return SiteName.Bodog;
Expand Down Expand Up @@ -101,6 +109,12 @@ public static SiteName ParseSiteName(string site)
case "partyit":
case "partypokerit":
return SiteName.PartyPokerIt;
case "partynj":
case "partypokernj":
return SiteName.PartyPokerNJ;
case "partyes":
case "partypokeres":
return SiteName.PartyPokerEs;
case "ongameit":
return SiteName.OnGameIt;
case "ongamefr":
Expand All @@ -110,6 +124,8 @@ public static SiteName ParseSiteName(string site)
case "ipokerfr":
return SiteName.IPokerFr;
case "ipoker2":
case "ipoker - low":
case "ipoker-low":
case "betmost":
return SiteName.IPoker2;
case "888":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace HandHistories.Parser.UnitTests.Parsers.HandSummaryParserTests.Tables
{
[TestFixture("PartyPoker", "Regular", "Regular", "Regular", "Regular")]
[TestFixture("PokerStars", "Regular", "Regular", "Regular", "Regular", "Zoom", "Cap")]
[TestFixture("PokerStars", "Regular", "Regular", "Deep", "Regular", "Zoom", "Cap")]
[TestFixture("OnGame", "Regular", "Regular", "Regular", "Speed")]
[TestFixture("IPoker", "Regular", "Regular", "Regular", "Shallow")]
[TestFixture("Pacific", "Regular", "Regular", "Regular", "Regular")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ protected override DateTime ParseDateUtc(string[] handLines)

switch (timeZone)
{
case "GMT":
return date;
case "CEST": // Central European Summer Time
return date.AddHours(-2);
case "BST": // British Summer TIme
case "CET":
return date.AddHours(-1);
case "PST":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public PokerStarsFastParserImpl(SiteName siteName = SiteName.PokerStars)

public override IEnumerable<string> SplitUpMultipleHands(string rawHandHistories)
{
var start = rawHandHistories[16] == '#' ? "PokerStars Game #" : "PokerStars Zoom Hand #";

return HandSplitRegex.Split(rawHandHistories)
.Where(s => string.IsNullOrWhiteSpace(s) == false && s.Length > 30)
.Select(s => "PokerStars Game #" + s.Trim('\r', 'n'));
.Select(s => start + s.Trim('\r', 'n'));
}

protected override int ParseDealerPosition(string[] handLines)
Expand Down Expand Up @@ -210,12 +212,16 @@ protected override GameType ParseGameType(string[] handLines)
protected override TableType ParseTableType(string[] handLines)
{
// Stars does not right out things such as speed/shallow/fast to hands right now.

if (handLines[1].Contains(" Zoom "))
if (handLines[1].Contains(" Zoom") || handLines[0].Contains(" Zoom"))
{
return TableType.FromTableTypeDescriptions(TableTypeDescription.Zoom);
}

if (handLines[1].Contains("100-250 bb"))
{
return TableType.FromTableTypeDescriptions(TableTypeDescription.Deep);
}

// older hand history files have the cap mark in the first line
if (handLines[1].LastIndexOf(" CAP", StringComparison.Ordinal) != -1 ||
handLines[0].LastIndexOf(" Cap ", StringComparison.Ordinal) != -1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ public class PartyHandHistoryRegexParserImpl : HandHistoryRegexParserImplBase
{
// Mantis Bug 92 - a possible speed optimization is converting these into constants
// foreach site so compiler can do its magic but how would we do overrides? and would this increase speed?
private readonly SiteName _siteName;

public PartyHandHistoryRegexParserImpl()
public override SiteName SiteName
{
get { return _siteName; }
}

public PartyHandHistoryRegexParserImpl(SiteName site = SiteName.PartyPoker)
: base()
{
_siteName = site;

}

public override SiteName SiteName { get { return SiteName.PartyPoker; } }

public override string TableNameRegex { get { return @"(?<=Table ).*(?= \(Real)"; } }

Expand All @@ -30,9 +37,9 @@ public PartyHandHistoryRegexParserImpl()

public override string GameNumberRegex { get { return @"(?<=Hand History for Game )\#{0,1}[0-9]*"; } }

public override string GameLimitRegex { get { return @"(?<=\n)\$[0-9,]*(\.[0-9]{2}){0,1}"; } }
public override string GameLimitRegex { get { return @"(?<=\n)(\$|€|£)[0-9,]*(\.[0-9]{2}){0,1}"; } }

public override string GameLimitRegexWithSlash { get { return @"(?<=\n)\$[0-9,]*(\.[0-9]{2}){0,1}/\$[0-9,]*(\.[0-9]{2}){0,1}"; } }
public override string GameLimitRegexWithSlash { get { return @"(?<=\n)(\$|€|£)[0-9,]*(\.[0-9]{2}){0,1}/(\$|€|£)[0-9,]*(\.[0-9]{2}){0,1}"; } }

public override string GameDateRegex { get { return @"(?<= - ).*, [012][0-9]:[0-5][0-9]:[0-5][0-9] [A-Za-z]{0,5} [0-9]{4}";} }

Expand All @@ -56,12 +63,12 @@ public override string GetHoleCardsRegex(string playerName)
const string regex = @"((?<={playerName} doesn't show \[ )([0-9TJKQAcdhs, ])+)|((?<={playerName} shows \[ )([0-9TJKQAcdhs, ])+)";
return regex.Replace("{playerName}", playerName).Replace("{Card}", cardHoleCard);
}
public override string SeatInfoRegex { get { return @"Seat [0-9]+: " + PlayerNameRegex + @" \( \$[0-9,.]+ USD \)"; } }

public override string SeatInfoRegex { get { return @"Seat [0-9]+: " + PlayerNameRegex + @" \( (\$|€|£)[0-9,.]+ (USD|GBP|EUR) \)"; } }

public override string SeatInfoPlayerNameRegex { get { return @"((?<=Seat [1-9]: )|(?<=Seat 10: )).*(?= \()"; } }

public override string SeatInfoStartingStackRegex { get { return @"(?<=\( \$).*(?= USD \))"; } }
public override string SeatInfoStartingStackRegex { get { return @"(?<=\( (\$|€|£)).*(?= (USD|GBP|EUR) \))"; } }

public override string SeatInfoSeatNumberRegex { get { return @"(?<=Seat )[0-9]+(?=:)"; } }

Expand Down Expand Up @@ -110,8 +117,8 @@ private Limit ParseLimit(GameType gameType, string tableName, string handText)
var gameLimitNoSlash = Regex.Match(handText, GameLimitRegex).Value;
var gameLimitWithSlash = Regex.Match(handText, GameLimitRegexWithSlash).Value;

gameLimitNoSlash = gameLimitNoSlash.Replace("$", "").Replace("*", "").Replace(",", "");
gameLimitWithSlash = gameLimitWithSlash.Replace("$", "").Replace("*", "").Replace(",", "");
gameLimitNoSlash = gameLimitNoSlash.Replace("", "").Replace("$", "").Replace("*", "").Replace(",", "");
gameLimitWithSlash = gameLimitWithSlash.Replace("", "").Replace("$", "").Replace("*", "").Replace(",", "");

// Handle 20BB tables, due to Party putting the limit up as 40% of the actual
// limit. So for instance 20BB party $100NL the limit is displayed as $40NL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ protected override string AddsRegex

protected override string WinsSidePotRegex
{
get { return @"^.* wins \$[0-9,.]+ USD from the side pot [0-9]+ with .*$"; }
get { return @"^.* wins (\$|€|£)[0-9,.]+ (USD|GBP|EUR) from the side pot [0-9]+ with .*$"; }
}

protected override string WinsPotRegex
{
get { return @"(^.* wins \$[0-9,.]+ USD$)|(^.* wins \$[0-9,.]+ USD from the main pot with .*$)"; }
get { return @"(^.* wins (\$|€|£)[0-9,.]+ (USD|GBP|EUR)$)|(^.* wins \$[0-9,.]+ (USD|GBP|EUR) from the main pot with .*$)"; }
}

protected override string WinsTheLowRegex
{
get { return @"^.* wins Lo \(\$[0-9,.]+ USD\) from the main pot with .*$"; }
get { return @"^.* wins Lo \((\$|€|£)[0-9,.]+ (USD|GBP|EUR)\) from the main pot with .*$"; }
}

protected override string UncalledBetRegex
Expand Down Expand Up @@ -61,12 +61,12 @@ protected override string StandsUpRegex

protected override string PostsSmallBlindRegex
{
get { return @"^.* posts small blind \[\$[0-9.,]+ USD\]\.$"; }
get { return @"^.* posts small blind \[(\$|€|£)[0-9.,]+ (USD|GBP|EUR)\]\.$"; }
}

protected override string PostsBigBlindRegex
{
get { return @"^.* posts big blind \[\$[0-9.,]+ USD\]\.$"; }
get { return @"^.* posts big blind \[(\$|€|£)[0-9.,]+ (USD|GBP|EUR)\]\.$"; }
}

protected override string SittingOutRegex
Expand Down Expand Up @@ -97,17 +97,17 @@ protected override string SecondsToReconnectRegex

protected override string RaiseToRegex
{
get { return @"^.* raises \[\$[0-9,.]+ USD\]$"; }
get { return @"^.* raises \[(\$|€|£)[0-9,.]+ (USD|GBP|EUR)\]$"; }
}

protected override string PostsRegex
{
get { return @"^.* posts big blind \+ dead \[\$[0-9.,]+\]\.$"; }
{
get { return @"^.* posts big blind \+ dead \[(\$|€|£)[0-9.,]+\]\.$"; }
}

protected override string AllInRegex
{
get { return @"^.* is all-In[ ]+[\$[0-9,.]+ USD\]$"; }
get { return @"^.* is all-In[ ]+[(\$|€|£)[0-9,.]+ (USD|GBP|EUR)\]$"; }
}

protected override string HasReturnedRegex
Expand All @@ -134,12 +134,12 @@ protected override string AntesRegex

protected override string BetsRegex
{
get { return @"^.* bets \[\$[0-9.,]+ USD\]$"; }
get { return @"^.* bets \[(\$|€|£)[0-9.,]+ (USD|GBP|EUR)\]$"; }
}

protected override string CallsRegex
{
get { return @"^.* calls [\$[0-9,.]+ USD\]$"; }
get { return @"^.* calls [(\$|€|£)[0-9,.]+ (USD|GBP|EUR)\]$"; }
}

protected override string ChatRegex
Expand Down Expand Up @@ -170,7 +170,7 @@ protected override string MucksRegex

public override string AmountRegex
{
get { return @"(?<=\$)[0-9.,]+(?= USD)"; }
get { return @"(?<=(\$|€|£))[0-9.,]+(?= (USD|GBP|EUR))"; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public abstract class SiteActionRegexesBase
protected abstract string SitsDownRegex { get; }
protected abstract string SittingOutRegex { get; }
protected abstract string ReconnectedRegex { get; }
protected abstract string HasReturnedRegex { get; }
public virtual string AmountRegex { get { return @"(?<=\$)[0-9.,]+(?= USD)"; } }
public virtual string PostAmountRegex { get { return @"(?<=\$)[0-9.,]+(?=].)"; } }
protected abstract string HasReturnedRegex { get; }

public virtual string AmountRegex { get { return @"(?<=(\$|€|£))[0-9.,]+(?= (USD|GBP|EUR))"; } }
public virtual string PostAmountRegex { get { return @"(?<=(\$|€|£))[0-9.,]+(?=].)"; } }

// Note: This is FTP only.
protected virtual string IsFeelingRegex { get { return null; } }
Expand Down

0 comments on commit 76a1874

Please sign in to comment.