/// <summary> /// Adjusts seat types of the specified <see cref="HandHistory"/> /// </summary> /// <param name="handHistory"><see cref="HandHistory"/> to adjust</param> protected override void AdjustSeatTypes(HandHistory handHistory) { if (!handHistory.GameDescription.SeatType.IsUnknown) { return; } var maxSeatNumber = handHistory.Players.MaxOrDefault(x => x.SeatNumber); if (maxSeatNumber > 9) { handHistory.GameDescription.SeatType = SeatType.FromMaxPlayers(10); } else if (maxSeatNumber > 8) { handHistory.GameDescription.SeatType = SeatType.FromMaxPlayers(9); } else if (maxSeatNumber > 6) { handHistory.GameDescription.SeatType = SeatType.FromMaxPlayers(8); } else if (maxSeatNumber > 3) { handHistory.GameDescription.SeatType = SeatType.FromMaxPlayers(6); } else if (maxSeatNumber > 2 && handHistory.GameDescription.IsTournament) { handHistory.GameDescription.SeatType = SeatType.FromMaxPlayers(3); } else { handHistory.GameDescription.SeatType = SeatType.FromMaxPlayers(2); } }
protected override SeatType ParseSeatType(string[] handLines) { // Line 5 onward is: // Players in round: 3 // Seat 8: Max Power s ($8.96) // Seat 9: EvilJihnny99 ($24.73) // Seat 10: huda22 ($21.50) int firstColon = handLines[4].LastIndexOf(':'); int numPlayers = Int32.Parse(handLines[4].Substring(firstColon + 1, handLines[4].Length - firstColon - 1)); if (numPlayers <= 2) { return(SeatType.FromMaxPlayers(2)); } if (numPlayers <= 6) { return(SeatType.FromMaxPlayers(6)); } if (numPlayers <= 9) { return(SeatType.FromMaxPlayers(9)); } return(SeatType.FromMaxPlayers(10)); }
public void SetUp() { _handHistory = new HandHistory() { ComumnityCards = BoardCards.ForFlop(Card.GetCardFromIntValue(5), Card.GetCardFromIntValue(14), Card.GetCardFromIntValue(40)), DateOfHandUtc = new DateTime(2012, 3, 20, 12, 30, 44), DealerButtonPosition = 5, FullHandHistoryText = "some hand text", GameDescription = new GameDescriptor(PokerFormat.CashGame, SiteName.PartyPoker, GameType.NoLimitHoldem, Limit.FromSmallBlindBigBlind(10, 20, Currency.USD), TableType.FromTableTypeDescriptions(TableTypeDescription.Regular), SeatType.FromMaxPlayers(6)), HandActions = new List <HandAction>() { new HandAction("Player1", HandActionType.POSTS, 0.25m, Street.Preflop) }, HandId = 141234124, NumPlayersSeated = 2, Players = new PlayerList() { new Player("Player1", 1000, 1), new Player("Player2", 300, 5), }, TableName = "Test Table", }; }
protected override SeatType ParseSeatType(string[] handLines) { // Line 5 onward is: // Players in round: 3 // Seat 8: Max Power s ($8.96) // Seat 9: EvilJihnny99 ($24.73) // Seat 10: huda22 ($21.50) //When Hero is playing there is one extra line //User: ONG_Hero //Button: seat 9 //Players in round: 4 (6) //Seat 1: Opponent1 ($200) //Seat 2: ONG_Hero ($200) int numPlayers = ParseNumberOfPlayers(handLines); if (numPlayers <= 2) { return(SeatType.FromMaxPlayers(2)); } if (numPlayers <= 6) { return(SeatType.FromMaxPlayers(6)); } if (numPlayers <= 9) { return(SeatType.FromMaxPlayers(9)); } return(SeatType.FromMaxPlayers(10)); }
protected override SeatType ParseSeatType(string[] handLines) { // Full Tilt Poker Game #26862468195: Table Adornment (6 max, shallow) - $0.50/$1 - No Limit Hold'em - 16:09:19 ET - 2010/12/31 string handLine = handLines[0]; string [] seatInfo = handLine.Split('('); // No ( means its full ring if (seatInfo.Length == 1) { return(SeatType.FromMaxPlayers(9)); } if (seatInfo[1].StartsWith("6 max")) { return(SeatType.FromMaxPlayers(6)); } else if (seatInfo[1].StartsWith("heads")) { return(SeatType.FromMaxPlayers(2)); } return(SeatType.FromMaxPlayers(9)); }
protected override SeatType ParseSeatType(string[] handLines) { // line 4 onward has all seated player // Seat 1: ovechkin08 (2000€) // Seat 4: R.BAGGIO (2000€) // *** ANTE/BLINDS *** int numPlayers = 0; for (int i = 3; i < handLines.Length; i++) { if (handLines[i].StartsWith("***")) { numPlayers = i - 3; break; } } if (numPlayers <= 2) { return(SeatType.FromMaxPlayers(2)); } if (numPlayers <= 6) { return(SeatType.FromMaxPlayers(6)); } if (numPlayers <= 9) { return(SeatType.FromMaxPlayers(9)); } return(SeatType.FromMaxPlayers(10)); }
protected override SeatType ParseSeatType(List <string> header) { var line = header[1]; var maxPlayers = FastInt.Parse(line, line.IndexOf(' ')); return(SeatType.FromMaxPlayers(maxPlayers)); }
protected override SeatType ParseSeatType(string[] handLines) { int Players = ParsePlayers(handLines).Count; SeatType seat = SeatType.FromMaxPlayers(Players, true); return(seat); }
protected override SeatType ParseSeatType(string[] handLines) { foreach (var line in handLines) { switch (line.ToLower()) { case string a when a.Contains("hu") || a.Contains("2-max") || a.Contains("heads up") || a.Contains("headsup") || a.Contains("heads-up"): return(SeatType.FromMaxPlayers(2)); case string a when a.Contains("3-max"): return(SeatType.FromMaxPlayers(3)); case string a when a.Contains("5-max"): return(SeatType.FromMaxPlayers(5)); case string a when a.Contains("6-max"): return(SeatType.FromMaxPlayers(6)); case string a when a.Contains("9-max"): return(SeatType.FromMaxPlayers(9)); case string a when a.StartsWithFast("***"): goto end_loop; } } end_loop : return(ParseSeatTypeObsolete(handLines)); }
private SeatType ParseSeatTypeObsolete(string[] handLines) { int numPlayers = 0; for (int i = 2; i < handLines.Length; i++) { if (handLines[i].StartsWithFast("***")) { numPlayers = i - 2; break; } } if (numPlayers <= 2) { return(SeatType.FromMaxPlayers(2)); } if (numPlayers <= 6) { return(SeatType.FromMaxPlayers(6)); } if (numPlayers <= 9) { return(SeatType.FromMaxPlayers(9)); } return(SeatType.FromMaxPlayers(10)); }
public void SetUp() { _handHistory = new HandHistory() { ComumnityCards = BoardCards.ForFlop(new Card(5), new Card(14), new Card(40)), DateOfHandUtc = new DateTime(2012, 3, 20, 12, 30, 44), DealerButtonPosition = 5, FullHandHistoryText = "some hand text", GameDescription = new GameDescriptor(PokerFormat.CashGame, SiteName.Values.PartyPoker, GameType.NoLimitHoldem, Limit.FromSmallBlindBigBlind(10, 20, Currency.USD), TableType.FromTableTypeDescriptions(TableTypeDescription.Regular), SeatType.FromMaxPlayers(6)), HandActions = new List <HandAction>() { new HandAction("Player1", HandActionType.POSTS, 0.25m, Street.Preflop) }, HandId = 141234124, NumPlayersSeated = 2, Players = new PlayerList() { new Player("Player1", 1000, 1), new Player("Player2", 300, 5), }, TableName = "Test Table", }; _handHistory.Players[0].HoleCards = new HoleCards(CardGroup.Parse("Ac Ad")); _handHistory.Players[1].HoleCards = new HoleCards(CardGroup.Parse("Kh Qs")); BsonSerializer.RegisterSerializationProvider(new TestSerializationProvider()); }
private void ProcessBlinds(int roomId, Blinds blinds, HandHistory handHistory) { if (!roomsData.TryGetValue(roomId, out RoomData roomData)) { throw new HandBuilderException(handHistory.HandId, $"RoomData has not been found for room #{roomId}."); } TournamentDescriptor tournament = null; var isSTT = roomData.GameType.Equals("STT", StringComparison.OrdinalIgnoreCase); var isMTT = !isSTT && roomData.GameType.Equals("MTT", StringComparison.OrdinalIgnoreCase); if (isSTT || isMTT) { tournament = new TournamentDescriptor { Speed = TournamentSpeed.Regular }; if (isSTT) { ProcessSTT(tournament, blinds.RoomName, roomData); tournament.StartDate = handHistory.DateOfHandUtc; } else { ProcessMTT(tournament, blinds.RoomName); } } var tableType = roomData.TurnTime != 0 && roomData.TurnTime <= 15 ? TableTypeDescription.Speed : TableTypeDescription.Regular; if (roomData.IsAnonymousTable) { tableType = TableTypeDescription.Anonymous; } var limit = Limit.FromSmallBlindBigBlind(blinds.SmallBlind, blinds.BigBlind, tournament != null ? Currency.Chips : (roomData.IsFreeroll ? Currency.PlayMoney : currency)); handHistory.GameDescription = new GameDescriptor( tournament != null ? PokerFormat.Tournament : PokerFormat.CashGame, EnumPokerSites.Adda52, GetGameType(roomData), limit, TableType.FromTableTypeDescriptions(tableType), SeatType.FromMaxPlayers(roomData.MaxPlayers), tournament); handHistory.GameDescription.Identifier = roomId; handHistory.TableName = blinds.RoomName; if (tournament == null) { handHistory.GameDescription.CashBuyInHigh = roomData.BuyinHigh; } }
public void ParseSeatType_9Handed() { switch (Site) { case SiteName.Winamax: Assert.Ignore(Site + " currently doesn't have 9 handed games."); break; } TestSeatType(SeatType.FromMaxPlayers(9)); }
public void ParseSeatType_HeadsUp() { switch (Site) { case SiteName.MicroGaming: Assert.Ignore(Site + " currently only has anonymous HU tables"); break; } TestSeatType(SeatType.FromMaxPlayers(2)); }
protected override SeatType ParseSeatType(string[] handLines) { var seatCount = int.Parse(SeatTypeRegex.Match(handLines[3]).Value.Replace(" Max", string.Empty)); if (seatCount > 0 && seatCount < 10) { return(SeatType.FromMaxPlayers(seatCount)); } return(SeatType.FromMaxPlayers(10)); }
public SeatType ParseSeatType(string handText) { try { int tableSize = Int32.Parse(Regex.Match(handText, TableSizeRegex).Value); return(SeatType.FromMaxPlayers(tableSize)); } catch (Exception exception) { throw new SeatTypeException(handText, "ParseSeatType: " + exception.Message); } }
/// <summary> /// Parses seat types from the specified HH lines /// </summary> /// <param name="handLines">Lines to parse</param> /// <returns>Seat type</returns> protected override SeatType ParseSeatType(string[] handLines) { var seatTypeLine = GetTableInfoLine(handLines); var seatTypeText = seatTypeLine.TakeBetween("' ", "-max"); if (!int.TryParse(seatTypeText, out int maxPlayers)) { throw new SeatTypeException(seatTypeLine, "Couldn't parse seat type."); } return(SeatType.FromMaxPlayers(maxPlayers)); }
public void PlayerNameWithSlashesAndSquareBrackets() { HandHistory expectedHand = new HandHistory() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.NoLimitHoldem, Limit = Limit.FromSmallBlindBigBlind(0.25m, 0.50m, Currency.USD), SeatType = SeatType.FromMaxPlayers(6), Site = SiteName.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Cap) }, DateOfHandUtc = new DateTime(2012, 9, 11, 12, 39, 12), DealerButtonPosition = 3, HandId = HandID.From(86015904171), NumPlayersSeated = 4, TableName = "Acamar IV CAP, Fast,20-50 bb" }; var expectedActions = new List <HandAction>() { new HandAction("vitinja", HandActionType.SMALL_BLIND, 0.25m, Street.Preflop), new HandAction("/\\ntiHer[]", HandActionType.BIG_BLIND, 0.50m, Street.Preflop), new HandAction("Catharina111", HandActionType.CALL, 0.50m, Street.Preflop), new HandAction("Willo2319", HandActionType.CALL, 0.50m, Street.Preflop), new HandAction("vitinja", HandActionType.FOLD, 0m, Street.Preflop), new HandAction("/\\ntiHer[]", HandActionType.CHECK, 0, Street.Preflop), new HandAction("/\\ntiHer[]", HandActionType.BET, 1, Street.Flop), new HandAction("Catharina111", HandActionType.FOLD, 0m, Street.Flop), new HandAction("Willo2319", HandActionType.CALL, 1m, Street.Flop), new HandAction("/\\ntiHer[]", HandActionType.BET, 1.50m, Street.Turn), new HandAction("Willo2319", HandActionType.CALL, 1.50m, Street.Turn), new HandAction("/\\ntiHer[]", HandActionType.CHECK, 0m, Street.River), new HandAction("Willo2319", HandActionType.CHECK, 0m, Street.River), new HandAction("/\\ntiHer[]", HandActionType.SHOW, 0m, Street.Showdown), new HandAction("Willo2319", HandActionType.SHOW, 0m, Street.Showdown), }; var expectedWinners = new List <WinningsAction>() { new WinningsAction("Willo2319", WinningsActionType.WINS, 6.45m, 0), }; HandHistory actualHand = TestFullHandHistory(expectedHand, "PlayerNameWithSlashesAndSquareBrackets"); Assert.AreEqual(expectedActions, actualHand.HandActions); Assert.AreEqual(expectedWinners, actualHand.Winners); }
protected override SeatType ParseSeatType(string[] handLines) { int players = 0; for (int i = 0; i < 10; i++) { string line = handLines[i + 1]; if (line[1] == 'P') { players++; } } return(SeatType.FromMaxPlayers(players, false)); }
/// <summary> /// Parses seat types from the specified HH lines /// </summary> /// <param name="handLines">Lines to parse</param> /// <returns>Seat type</returns> protected override SeatType ParseSeatType(string[] handLines) { var seatLine = handLines[0]; if (seatLine.IndexOf("10 Max", StringComparison.OrdinalIgnoreCase) >= 0) { return(SeatType.FromMaxPlayers(10)); } if (seatLine.IndexOf("9 Max", StringComparison.OrdinalIgnoreCase) >= 0) { return(SeatType.FromMaxPlayers(9)); } if (seatLine.IndexOf("8 Max", StringComparison.OrdinalIgnoreCase) >= 0) { return(SeatType.FromMaxPlayers(8)); } if (seatLine.IndexOf("6 Max", StringComparison.OrdinalIgnoreCase) >= 0 || seatLine.IndexOf("Six Max", StringComparison.OrdinalIgnoreCase) >= 0) { return(SeatType.FromMaxPlayers(6)); } if (seatLine.IndexOf("3 Max", StringComparison.OrdinalIgnoreCase) >= 0) { return(SeatType.FromMaxPlayers(3)); } var maxPlayers = 0; var maxPlayersIndex = seatLine.IndexOf("-max", StringComparison.OrdinalIgnoreCase); if (maxPlayersIndex > 0) { var maxPlayersText = seatLine.Substring(maxPlayersIndex - 1, 1); maxPlayers = int.Parse(maxPlayersText); if (maxPlayers == 0) { maxPlayers = 10; } } return(SeatType.FromMaxPlayers(maxPlayers)); }
private EnumReplayerTableType GetTableSize(ReplayerViewModel viewModel) { SeatType seatType = SeatType.FromMaxPlayers(viewModel.CurrentGame.GameDescription.SeatType.MaxPlayers, true); if (seatType.MaxPlayers <= 6) { return(EnumReplayerTableType.Six); } if (seatType.MaxPlayers <= 9) { return(EnumReplayerTableType.Nine); } return(EnumReplayerTableType.Ten); }
public void ParseSeatType_10Handed() { switch (Site) { case SiteName.PartyPoker: case SiteName.Merge: case SiteName.OnGame: case SiteName.Entraction: case SiteName.FullTilt: case SiteName.Pacific: Assert.Ignore(Site + " currently doesn't have 10 handed games."); break; } TestSeatType(SeatType.FromMaxPlayers(10)); }
private void ParseCashStartRoomStateChange(SCGameRoomStateChange startRoomStateChange, GameRoomInfo gameRoomInfo, HandHistory handHistory) { var gameRoomBaseInfo = gameRoomInfo.GameRoomBaseInfo ?? throw new HandBuilderException(handHistory.HandId, "GameRoomBaseInfo must be not empty."); handHistory.TableName = startRoomStateChange.GameRoomInfo?.GameRoomBaseInfo?.RoomName; handHistory.GameDescription = new GameDescriptor( EnumPokerSites.PokerMaster, ParseGameType(gameRoomInfo), Limit.FromSmallBlindBigBlind(gameRoomBaseInfo.SmallBlinds, gameRoomBaseInfo.BigBlinds, Currency.YUAN, gameRoomBaseInfo.IsAnteRoom, gameRoomBaseInfo.Ante), ParseTableType(gameRoomInfo), SeatType.FromMaxPlayers(gameRoomBaseInfo.GameRoomUserMaxNums), null ); handHistory.GameDescription.IsStraddle = gameRoomBaseInfo.Straddle; handHistory.GameDescription.Identifier = gameRoomBaseInfo.GameRoomId; }
protected override SeatType ParseSeatType(string[] handLines) { // line two looks like : // Table 'Alcor V' 6-max Seat #4 is the button int secondDash = handLines[1].LastIndexOf('\''); // 2-max, 6-max or 9-max int maxPlayers = FastInt.Parse(handLines[1][secondDash + 2]); // can't have 1max so must be 10max if (maxPlayers == 1) { maxPlayers = 10; } return(SeatType.FromMaxPlayers(maxPlayers)); }
protected override SeatType ParseSeatType(string[] handLines) { // line 5 looks like : // "Total number of players : 2/6 " int maxPlayerIndex = handLines[4].LastIndexOf('/') + 1; // 2-max, 6-max or 9-max int maxPlayers = FastInt.Parse(handLines[4][maxPlayerIndex]); // can't have 1max so must be 10max if (maxPlayers == 1) { maxPlayers = 10; } return(SeatType.FromMaxPlayers(maxPlayers)); }
protected override SeatType ParseSeatType(List <string> header) { // line 5 looks like : // "Total number of players : 2/6 " var line = header[4]; int maxPlayerIndex = line.LastIndexOf('/') + 1; // 2-max, 6-max or 9-max int maxPlayers = FastInt.Parse(line[maxPlayerIndex]); // can't have 1max so must be 10max if (maxPlayers == 1) { maxPlayers = 10; } return(SeatType.FromMaxPlayers(maxPlayers)); }
private void ParseTournamentStartRoomStateChange(SCGameRoomStateChange startRoomStateChange, GameRoomInfo gameRoomInfo, HandHistory handHistory) { var gameRoomBaseInfo = gameRoomInfo.SNGGameRoomBaseInfo ?? throw new HandBuilderException(handHistory.HandId, "SNGGameRoomBaseInfo must be not empty."); handHistory.TableName = startRoomStateChange.GameRoomInfo?.SNGGameRoomBaseInfo?.RoomName; handHistory.GameDescription = new GameDescriptor( PokerFormat.Tournament, EnumPokerSites.PokerMaster, ParseGameType(gameRoomInfo), Limit.FromSmallBlindBigBlind(gameRoomBaseInfo.SmallBlinds, gameRoomBaseInfo.BigBlinds, Currency.YUAN, true, gameRoomBaseInfo.Ante), ParseTableType(gameRoomInfo), SeatType.FromMaxPlayers(gameRoomBaseInfo.GameRoomUserMaxNums), ParseTournamentDescriptor(gameRoomInfo) ) { Identifier = gameRoomBaseInfo.GameRoomId }; }
public void ParseSeatType_4Max() { switch (Site) { case SiteName.IPoker: case SiteName.Merge: case SiteName.PartyPoker: case SiteName.PokerStars: case SiteName.OnGame: case SiteName.Entraction: case SiteName.Pacific: case SiteName.FullTilt: Assert.Ignore(Site + " currently doesn't have 4 max games."); break; } TestSeatType(SeatType.FromMaxPlayers(4)); }
public void ParseSeatType_10Handed() { switch ((SiteName.Values)Site) { case SiteName.Values.PartyPoker: case SiteName.Values.Merge: case SiteName.Values.OnGame: case SiteName.Values.Entraction: case SiteName.Values.FullTilt: case SiteName.Values.MicroGaming: case SiteName.Values.IPoker: case SiteName.Values.Winamax: Assert.Ignore(Site + " currently doesn't have 10 handed games."); break; } TestSeatType(SeatType.FromMaxPlayers(10)); }
protected override SeatType ParseSeatType(string[] handLines) { string[] playerLines = GetPlayerLinesFromHandLines(handLines); int numPlayers = playerLines.Count(); if (numPlayers <= 2) { return(SeatType.FromMaxPlayers(2)); } if (numPlayers <= 6) { return(SeatType.FromMaxPlayers(6)); } if (numPlayers <= 9) { return(SeatType.FromMaxPlayers(9)); } return(SeatType.FromMaxPlayers(10)); }