示例#1
0
        private void CompareOnTurn()
        {
            var heroSix = new SixCardsHand(HeroHoles.Hole1, HeroHoles.Hole2,
                                           BoardStatus.Flop1, BoardStatus.Flop2, BoardStatus.Flop3, BoardStatus.Turn);
            var villainSix = new SixCardsHand(VillainHoles.Hole1, VillainHoles.Hole2,
                                              BoardStatus.Flop1, BoardStatus.Flop2, BoardStatus.Flop3, BoardStatus.Turn);

            var heroBest    = BettingUtils.FindBestFive(heroSix);
            var villainBest = BettingUtils.FindBestFive(villainSix);

            var heroScore    = BettingUtils.GetScoreForFiveCardHand(heroBest);
            var villainScore = BettingUtils.GetScoreForFiveCardHand(villainBest);

            HeroIsAhead = heroScore > villainScore;

            var allCards = TexasBot.Tools.Utils.GenerateAllCards().Select(c => c.ConvertCard()).ToList();

            allCards.RemoveElementEqualsTo(HeroHoles.Hole1);
            allCards.RemoveElementEqualsTo(HeroHoles.Hole2);
            allCards.RemoveElementEqualsTo(VillainHoles.Hole1);
            allCards.RemoveElementEqualsTo(VillainHoles.Hole2);
            allCards.RemoveElementEqualsTo(BoardStatus.Flop1);
            allCards.RemoveElementEqualsTo(BoardStatus.Flop2);
            allCards.RemoveElementEqualsTo(BoardStatus.Flop3);
            allCards.RemoveElementEqualsTo(BoardStatus.Turn);

            SixCardsHand leader   = HeroIsAhead ? heroSix : villainSix;
            SixCardsHand follower = HeroIsAhead ? villainSix : heroSix;
            List <Card>  outs     = HeroIsAhead ? VillainOuts : HeroOuts;

            outs.AddRange(allCards.Where(card => CardCanHelp(leader, follower, card)));
        }
示例#2
0
        /// <summary>
        /// If card can help follower to get ahead of leader
        /// </summary>
        /// <param name="leader"></param>
        /// <param name="follower"></param>
        /// <param name="card"></param>
        /// <returns></returns>
        private bool CardCanHelp(SixCardsHand leader, SixCardsHand follower, Card card)
        {
            var leaderSeven   = new SevenCardsHand(leader.Hole1, leader.Hole2, leader.Flop1, leader.Flop2, leader.Flop3, leader.Turn, card);
            var followerSeven = new SevenCardsHand(follower.Hole1, follower.Hole2, follower.Flop1, follower.Flop2, follower.Flop3, follower.Turn, card);

            var leaderBest   = BettingUtils.FindBestFive(leaderSeven);
            var followerBest = BettingUtils.FindBestFive(followerSeven);

            var leaderScore   = BettingUtils.GetScoreForFiveCardHand(leaderBest);
            var followerScore = BettingUtils.GetScoreForFiveCardHand(followerBest);

            return(followerScore > leaderScore);
        }
示例#3
0
        /// <summary>
        /// If card can help follower to get ahead of leader
        /// </summary>
        /// <param name="leader"></param>
        /// <param name="follower"></param>
        /// <param name="card"></param>
        /// <returns></returns>
        private bool CardCanHelp(BestFiveCardsHand leader, BestFiveCardsHand follower, Card card)
        {
            var leaderSix   = new SixCardsHand(leader.Cards[0], leader.Cards[1], leader.Cards[2], leader.Cards[3], leader.Cards[4], card);
            var followerSix = new SixCardsHand(follower.Cards[0], follower.Cards[1], follower.Cards[2], follower.Cards[3], follower.Cards[4], card);

            var leaderBest   = BettingUtils.FindBestFive(leaderSix);
            var followerBest = BettingUtils.FindBestFive(followerSix);

            var leaderScore   = BettingUtils.GetScoreForFiveCardHand(leaderBest);
            var followerScore = BettingUtils.GetScoreForFiveCardHand(followerBest);

            return(followerScore > leaderScore);
        }