public HighTriLowPairRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.HighTri: var highTriTexture = new Turn.TurnBoardRankTextures.HighTriRankTexture(TurnBoard); TriCard1 = highTriTexture.TriCard1; TriCard2 = highTriTexture.TriCard2; TriCard3 = highTriTexture.TriCard3; if (highTriTexture.SingleCard.Rank != board.River.Rank) { throw new InvalidOperationException(); } PairCard1 = highTriTexture.SingleCard; PairCard2 = board.River; break; case TurnBoardRankTextureEnum.TwoPairs: var twoPairsTexture = new TwoPairsRankTexture(TurnBoard); if (twoPairsTexture.HighPairCard1.Rank != board.River.Rank) { throw new InvalidOperationException(); } TriCard1 = twoPairsTexture.HighPairCard1; TriCard2 = twoPairsTexture.HighPairCard2; TriCard3 = board.River; PairCard1 = twoPairsTexture.LowPairCard1; PairCard2 = twoPairsTexture.LowPairCard2; break; default: throw new InvalidOperationException(); } }
public SinglesRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; if (TurnBoard.RankTexture != TurnBoardRankTextureEnum.Singles) { throw new InvalidOperationException(); } var singlesTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard); if (board.River.Rank == singlesTexture.HighCard.Rank || board.River.Rank == singlesTexture.SecondCard.Rank || board.River.Rank == singlesTexture.ThirdCard.Rank || board.River.Rank == singlesTexture.LowCard.Rank) { throw new InvalidOperationException(); } var cards = new List <Card>() { board.River, singlesTexture.HighCard, singlesTexture.SecondCard, singlesTexture.ThirdCard, singlesTexture.LowCard }; cards.Sort(); HighCard = cards[4]; SecondCard = cards[3]; ThirdCard = cards[2]; FourthCard = cards[1]; LowCard = cards[0]; }
public SuitedFourTexture(RiverBoard riverBoard) { if (riverBoard.SuitTexture != RiverSuitTextureEnum.FourSuited) { throw new InvalidOperationException(); } switch (riverBoard.TurnBoard.SuitTexture) { case TurnBoardSuitTextureEnum.SuitedFour: var suitedFourTurnBoard = new Turn.TurnBoardSuitTextures.SuitedFourTexture(riverBoard.TurnBoard); Suit = suitedFourTurnBoard.SuitedSuit; SuitedRanks = new List <RankEnum>(suitedFourTurnBoard.Ranks); break; case TurnBoardSuitTextureEnum.SuitedThree: var suitedThreeTurnBoard = new Turn.TurnBoardSuitTextures.SuitedThreeTexture(riverBoard.TurnBoard); Suit = suitedThreeTurnBoard.SuitedSuit; SuitedRanks = new List <RankEnum>(suitedThreeTurnBoard.SuitedRanks); SuitedRanks.Add(riverBoard.River.Rank); break; default: throw new InvalidOperationException(); } }
public HeadsupRiverBettingStrategy(RiverBoard riverBoard, HoldingHoles heroHoles) { _riverBoard = riverBoard; _riverFolder = new RiverFolder(); _probabilityCalculator = new VillainProbabilityCalculator( grid => _riverFolder.ShouldAGridFoldToBoardByRank(grid, _riverBoard), grid => _riverFolder.ShouldAGridFoldToBoardBySuit(grid, _riverBoard, heroHoles), () => DumbEnumerate(_riverBoard)); }
public ThirdPairRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.MiddlePair: var middlePairTexture = new MiddlePairRankTexture(TurnBoard); if (board.River.Rank <= middlePairTexture.PairCard1.Rank || board.River.Rank == middlePairTexture.HighCard.Rank) { throw new InvalidOperationException(); } if (board.River.Rank > middlePairTexture.HighCard.Rank) { HighCard = board.River; SecondCard = middlePairTexture.HighCard; } else { HighCard = middlePairTexture.HighCard; SecondCard = board.River; } PairedCard1 = middlePairTexture.PairCard1; PairedCard2 = middlePairTexture.PairCard2; LowCard = middlePairTexture.LowCard; break; case TurnBoardRankTextureEnum.LowPair: var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard); if (board.River.Rank >= lowPairTexture.PairCard1.Rank) { throw new InvalidOperationException(); } HighCard = lowPairTexture.HighCard; SecondCard = lowPairTexture.MiddleCard; PairedCard1 = lowPairTexture.PairCard1; PairedCard2 = lowPairTexture.PairCard2; LowCard = board.River; break; case TurnBoardRankTextureEnum.Singles: var singlesTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard); if (board.River.Rank != singlesTexture.ThirdCard.Rank) { throw new InvalidOperationException(); } HighCard = singlesTexture.HighCard; SecondCard = singlesTexture.SecondCard; PairedCard1 = singlesTexture.ThirdCard; PairedCard2 = board.River; LowCard = singlesTexture.LowCard; break; default: throw new InvalidOperationException(); } }
private IEnumerable <List <Card> > DumbEnumerate(RiverBoard riverBoard) { yield return(new List <Card>() { riverBoard.TurnBoard.FlopBoard.Flop1, riverBoard.TurnBoard.FlopBoard.Flop2, riverBoard.TurnBoard.FlopBoard.Flop3, riverBoard.TurnBoard.TurnCard, riverBoard.River }); }
public MultiwayRiverCallingStrategy(RiverBoard riverBoard, HoldingHoles heroHoles) { _riverBoard = riverBoard; _riverFolder = new RiverFolder(); var fiveCardsEnumerator = new RiverFiveCardsEnumerator(riverBoard); _probabilityCalculator = new VillainProbabilityCalculator( grid => _riverFolder.ShouldAGridFoldToBoardByRank(grid, _riverBoard), grid => _riverFolder.ShouldAGridFoldToBoardBySuit(grid, _riverBoard, heroHoles), fiveCardsEnumerator.Enumerate); }
public HighPairRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.HighPair: var highPairTexture = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard); if (board.River.Rank >= highPairTexture.PairCard1.Rank) { throw new InvalidOperationException(); } if (board.River.Rank == highPairTexture.MiddleCard.Rank || board.River.Rank == highPairTexture.LowCard.Rank) { throw new InvalidOperationException(); } PairedCard1 = highPairTexture.PairCard1; PairedCard2 = highPairTexture.PairCard2; var singles = new List <Card>() { highPairTexture.MiddleCard, highPairTexture.LowCard, board.River }; singles.Sort(); LowCard = singles[0]; ThirdCard = singles[1]; SecondCard = singles[2]; break; case TurnBoardRankTextureEnum.Singles: var singlesPairTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard); if (board.River.Rank != singlesPairTexture.HighCard.Rank) { throw new InvalidOperationException(); } PairedCard1 = singlesPairTexture.HighCard; PairedCard2 = board.River; SecondCard = singlesPairTexture.SecondCard; ThirdCard = singlesPairTexture.ThirdCard; LowCard = singlesPairTexture.LowCard; break; default: throw new InvalidOperationException(); } }
public HighLowTwoPairsRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.HighPair: var highPairTexture = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard); if (board.River.Rank != highPairTexture.LowCard.Rank) { throw new InvalidOperationException(); } HighPairCard1 = highPairTexture.PairCard1; HighPairCard2 = highPairTexture.PairCard2; MiddleCard = highPairTexture.MiddleCard; LowPairCard1 = highPairTexture.LowCard; LowPairCard2 = board.River; break; case TurnBoardRankTextureEnum.LowPair: var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard); if (board.River.Rank != lowPairTexture.HighCard.Rank) { throw new InvalidOperationException(); } HighPairCard1 = lowPairTexture.HighCard; HighPairCard2 = board.River; MiddleCard = lowPairTexture.MiddleCard; LowPairCard1 = lowPairTexture.PairCard1; LowPairCard2 = lowPairTexture.PairCard2; break; case TurnBoardRankTextureEnum.TwoPairs: var twoPairsTexture = new TwoPairsRankTexture(TurnBoard); if (board.River.Rank >= twoPairsTexture.HighPairCard1.Rank || board.River.Rank <= twoPairsTexture.LowPairCard1.Rank) { throw new InvalidOperationException(); } HighPairCard1 = twoPairsTexture.HighPairCard1; HighPairCard2 = twoPairsTexture.HighPairCard2; MiddleCard = board.River; LowPairCard1 = twoPairsTexture.LowPairCard1; LowPairCard2 = twoPairsTexture.LowPairCard2; break; default: throw new InvalidOperationException(); } }
public MiddleTriRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.HighTri: var highTriTexture = new Turn.TurnBoardRankTextures.HighTriRankTexture(TurnBoard); if (board.River.Rank <= highTriTexture.TriCard1.Rank) { throw new InvalidOperationException(); } HighCard = board.River; TriCard1 = highTriTexture.TriCard1; TriCard2 = highTriTexture.TriCard2; TriCard3 = highTriTexture.TriCard3; LowCard = highTriTexture.SingleCard; break; case TurnBoardRankTextureEnum.LowTri: var lowTriTexture = new Turn.TurnBoardRankTextures.LowTriRankTexture(TurnBoard); if (board.River.Rank >= lowTriTexture.TriCard1.Rank) { throw new InvalidOperationException(); } HighCard = lowTriTexture.SingleCard; TriCard1 = lowTriTexture.TriCard1; TriCard2 = lowTriTexture.TriCard2; TriCard3 = lowTriTexture.TriCard3; LowCard = board.River; break; case TurnBoardRankTextureEnum.MiddlePair: var middlePairTexture = new MiddlePairRankTexture(TurnBoard); if (board.River.Rank != middlePairTexture.PairCard1.Rank) { throw new InvalidOperationException(); } HighCard = middlePairTexture.HighCard; TriCard1 = middlePairTexture.PairCard1; TriCard2 = middlePairTexture.PairCard2; TriCard3 = board.River; LowCard = middlePairTexture.LowCard; break; default: throw new InvalidOperationException(); } }
public bool ShouldAGridFoldToBoardByRank(RangeGrid grid, RiverBoard riverBoard) { switch (riverBoard.RankTexture) { case RiverRankTextureEnum.Foursome: return(new FoursomeRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.HighTriLowPair: return(new HighTriLowPairRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.LowTriHighPair: return(new LowTriHighPairRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.HighTri: return(new HighTriRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.MiddleTri: return(new MiddleTriRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.LowTri: return(new LowTriRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.HighTwoPairs: return(new HighTwoPairsRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.HighLowTwoPairs: return(new HighLowTwoPairsRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.LowTwoPairs: return(new LowTwoPairsRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.HighPair: return(new HighPairRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.SecondPair: return(new SecondPairRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.ThirdPair: return(new ThirdPairRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.LowPair: return(new LowPairRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverRankTextureEnum.Singles: return(new SinglesRankTexture(riverBoard).ShouldAGridFoldToBet(grid)); } throw new InvalidOperationException(); }
public SuitedThreeTexture(RiverBoard riverBoard) { if (riverBoard.SuitTexture != RiverSuitTextureEnum.ThreeSuited) { throw new InvalidOperationException(); } switch (riverBoard.TurnBoard.SuitTexture) { case TurnBoardSuitTextureEnum.SuitedThree: var suitedThreeTurnBoard = new Turn.TurnBoardSuitTextures.SuitedThreeTexture(riverBoard.TurnBoard); Suit = suitedThreeTurnBoard.SuitedSuit; SuitedRanks = new List <RankEnum>(suitedThreeTurnBoard.SuitedRanks); break; case TurnBoardSuitTextureEnum.SuitedTwoPairs: var suitedTwoPairsTurnBoard = new SuitedTwoPairsTexture(riverBoard.TurnBoard); Suit = riverBoard.River.Suit; if (suitedTwoPairsTurnBoard.SuitedSuit1 == Suit) { SuitedRanks = new List <RankEnum>(suitedTwoPairsTurnBoard.Suit1Ranks); SuitedRanks.Add(riverBoard.River.Rank); } else if (suitedTwoPairsTurnBoard.SuitedSuit2 == Suit) { SuitedRanks = new List <RankEnum>(suitedTwoPairsTurnBoard.Suit2Ranks); SuitedRanks.Add(riverBoard.River.Rank); } else { throw new InvalidOperationException(); } break; case TurnBoardSuitTextureEnum.SuitedTwo: var suitedTwoTurnBoard = new SuitedTwoTexture(riverBoard.TurnBoard); Suit = suitedTwoTurnBoard.SuitedSuit; SuitedRanks = new List <RankEnum>(suitedTwoTurnBoard.SuitedRanks); SuitedRanks.Add(riverBoard.River.Rank); break; default: throw new InvalidOperationException(); } }
public FoursomeRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.Foursome: FoursomeCard1 = TurnBoard.FlopBoard.Flop1; FoursomeCard2 = TurnBoard.FlopBoard.Flop2; FoursomeCard3 = TurnBoard.FlopBoard.Flop3; FoursomeCard4 = TurnBoard.TurnCard; SingleCard = board.River; break; case TurnBoardRankTextureEnum.HighTri: var highTriTexture = new Turn.TurnBoardRankTextures.HighTriRankTexture(TurnBoard); FoursomeCard1 = highTriTexture.TriCard1; FoursomeCard2 = highTriTexture.TriCard2; FoursomeCard3 = highTriTexture.TriCard3; if (board.River.Rank != FoursomeCard1.Rank) { throw new InvalidOperationException(); } FoursomeCard4 = board.River; SingleCard = highTriTexture.SingleCard; break; case TurnBoardRankTextureEnum.LowTri: var lowTriTexture = new Turn.TurnBoardRankTextures.LowTriRankTexture(TurnBoard); FoursomeCard1 = lowTriTexture.TriCard1; FoursomeCard2 = lowTriTexture.TriCard2; FoursomeCard3 = lowTriTexture.TriCard3; if (board.River.Rank != FoursomeCard1.Rank) { throw new InvalidOperationException(); } FoursomeCard4 = board.River; SingleCard = lowTriTexture.SingleCard; break; default: throw new InvalidOperationException(); } }
public LowPairRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.LowPair: var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard); if (board.River.Rank <= lowPairTexture.PairCard1.Rank || board.River.Rank == lowPairTexture.HighCard.Rank || board.River.Rank == lowPairTexture.MiddleCard.Rank) { throw new InvalidOperationException(); } var cards = new List <Card>() { lowPairTexture.HighCard, lowPairTexture.MiddleCard, board.River }; cards.Sort(); HighCard = cards[2]; SecondCard = cards[1]; ThirdCard = cards[0]; PairedCard1 = lowPairTexture.PairCard1; PairedCard2 = lowPairTexture.PairCard2; break; case TurnBoardRankTextureEnum.Singles: var singlesTexture = new Turn.TurnBoardRankTextures.SinglesRankTexture(TurnBoard); if (board.River.Rank != singlesTexture.LowCard.Rank) { throw new InvalidOperationException(); } HighCard = singlesTexture.HighCard; SecondCard = singlesTexture.SecondCard; ThirdCard = singlesTexture.ThirdCard; PairedCard1 = singlesTexture.LowCard; PairedCard2 = board.River; break; default: throw new InvalidOperationException(); } }
public LowTriRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.LowTri: var lowTriTexture = new Turn.TurnBoardRankTextures.LowTriRankTexture(TurnBoard); if (board.River.Rank == lowTriTexture.SingleCard.Rank || board.River.Rank < lowTriTexture.TriCard1.Rank) { throw new InvalidOperationException(); } HighCard = board.River.Rank > lowTriTexture.SingleCard.Rank ? board.River : lowTriTexture.SingleCard; MiddleCard = board.River.Rank < lowTriTexture.SingleCard.Rank ? board.River : lowTriTexture.SingleCard; TriCard1 = lowTriTexture.TriCard1; TriCard2 = lowTriTexture.TriCard2; TriCard3 = lowTriTexture.TriCard3; break; case TurnBoardRankTextureEnum.LowPair: var lowPairTexture = new Turn.TurnBoardRankTextures.LowPairRankTexture(TurnBoard); if (board.River.Rank != lowPairTexture.PairCard1.Rank) { throw new InvalidOperationException(); } HighCard = lowPairTexture.HighCard; MiddleCard = lowPairTexture.MiddleCard; TriCard1 = lowPairTexture.PairCard1; TriCard2 = lowPairTexture.PairCard2; TriCard3 = board.River; break; default: throw new InvalidOperationException(); } }
public HighTriRankTexture(RiverBoard board) { TurnBoard = board.TurnBoard; switch (TurnBoard.RankTexture) { case TurnBoardRankTextureEnum.HighTri: var highTriTexture = new Turn.TurnBoardRankTextures.HighTriRankTexture(TurnBoard); if (board.River.Rank == highTriTexture.SingleCard.Rank || board.River.Rank == highTriTexture.TriCard1.Rank) { throw new InvalidOperationException(); } TriCard1 = highTriTexture.TriCard1; TriCard2 = highTriTexture.TriCard2; TriCard3 = highTriTexture.TriCard3; MiddleCard = highTriTexture.SingleCard.Rank > board.River.Rank ? highTriTexture.SingleCard : board.River; LowCard = highTriTexture.SingleCard.Rank < board.River.Rank ? highTriTexture.SingleCard : board.River; break; case TurnBoardRankTextureEnum.HighPair: var highPairTexture = new Turn.TurnBoardRankTextures.HighPairRankTexture(TurnBoard); if (board.River.Rank != highPairTexture.PairCard1.Rank) { throw new InvalidOperationException(); } TriCard1 = highPairTexture.PairCard1; TriCard2 = highPairTexture.PairCard2; TriCard3 = board.River; MiddleCard = highPairTexture.MiddleCard; LowCard = highPairTexture.LowCard; break; default: throw new InvalidOperationException(); } }
public Dictionary <Tuple <SuitEnum, SuitEnum>, bool> ShouldAGridFoldToBoardBySuit(RangeGrid grid, RiverBoard riverBoard, HoldingHoles heroHoles) { var conflictCards = new List <Card>() { heroHoles.Hole1, heroHoles.Hole2, riverBoard.River, riverBoard.TurnBoard.TurnCard, riverBoard.TurnBoard.FlopBoard.Flop1, riverBoard.TurnBoard.FlopBoard.Flop2, riverBoard.TurnBoard.FlopBoard.Flop3 }; grid.EliminateConflicts(conflictCards); switch (riverBoard.SuitTexture) { case RiverSuitTextureEnum.FiveSuited: return(new SuitedFiveTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverSuitTextureEnum.FourSuited: return(new SuitedFourTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverSuitTextureEnum.ThreeSuited: return(new SuitedThreeTexture(riverBoard).ShouldAGridFoldToBet(grid)); case RiverSuitTextureEnum.Offsuit: return(new OffsuitTexture().ShouldAGridFoldToBet(grid)); } throw new InvalidOperationException(); }