private PkResult PkV2(HoldingHoles heroHoles, PlayerRangePkGrid villainGrid, List <Card> fullBoard) { var pkResult = new PkResult(); SuitEnum suit; int suitedCount; var boardSuited = FullBoardHasThreeSuitedCards(fullBoard, out suit, out suitedCount); IHand bestHeroHand = boardSuited ? FindBestHand(heroHoles, fullBoard, suit) : FindBestOffsuitHand(heroHoles, fullBoard); foreach (var villainHoles in _holesEnumerator(villainGrid)) { IHand bestVillainHand = boardSuited ? FindBestHand(villainHoles, fullBoard, suit) : FindBestOffsuitHand(villainHoles, fullBoard); var pk = bestHeroHand.CompareTo(bestVillainHand); if (pk == 0) { pkResult.TiedScenariosCount++; } else if (pk < 0) { pkResult.VillainWinScenariosCount++; } else if (pk > 0) { pkResult.HeroWinScenariosCount++; } } return(pkResult); }
private PkResult Pk(HoldingHoles heroHoles, PlayerRangePkGrid villainGrid) { var pkResult = new PkResult(); foreach (var fiveCards in _fiveCardsEnumerator.Invoke()) { if (ConflictsWithVillainGrid(fiveCards, villainGrid.Grid)) { continue; } var conflictCards = new List <Card>(fiveCards); conflictCards.Add(heroHoles.Hole1); conflictCards.Add(heroHoles.Hole2); villainGrid.Grid.EliminateConflicts(conflictCards); var turnRiverPkResult = PkV2(heroHoles, villainGrid, fiveCards); pkResult.Add(turnRiverPkResult); } return(pkResult); }
public void Add(PkResult other) { if (other.HeroWinScenariosCount < 0 || other.TiedScenariosCount < 0 || other.VillainFoldCount < 0 || other.VillainWinScenariosCount < 0) { throw new InvalidOperationException(); } HeroWinScenariosCount += other.HeroWinScenariosCount; VillainWinScenariosCount += other.VillainWinScenariosCount; TiedScenariosCount += other.TiedScenariosCount; VillainFoldCount += other.VillainFoldCount; }
public PkResult Pk(HoldingHoles heroHoles, VillainPkRange villainRange) { var pkResult = new PkResult(); Parallel.ForEach(villainRange.Grids.EnumerateMultiDimensionalArray(), playerGrid => { var gridPkResult = Pk(heroHoles, playerGrid); Logger.Instance.Log($"Pk finished between heroHoles {heroHoles.Hole1.GetStringForCard() + heroHoles.Hole2.GetStringForCard()}" + $" and {playerGrid.Grid}, result is {gridPkResult}"); pkResult.Add(gridPkResult); }); return(pkResult); }