public void TestingAlgorithm_Calculate_Card_Power_FullHouseThreeOfAKindFirst_ShouldPass() { ICard card1 = new Card(11, 'S'); ICard card2 = new Card(11, 'S'); ICard card3 = new Card(7, 'S'); ICard card4 = new Card(7, 'S'); ICard card5 = new Card(7, 'S'); IHand hand = new Hand(); IList <ICard> combination = new List <ICard>() { card1, card2, card3, card4, card5 }; hand.CurrentCards = combination; CardPowerCalculator.GetCurrentStrengthOfCards(hand); Assert.AreEqual(HandStrengthEnum.FullHouse, hand.Strength); }
public void TestingAlgorithm_Calculate_Card_Power_FlushNotSequential_ShouldPass() { ICard card1 = new Card(12, 'S'); ICard card2 = new Card(9, 'S'); ICard card3 = new Card(5, 'H'); ICard card4 = new Card(10, 'H'); ICard card5 = new Card(5, 'S'); ICard card6 = new Card(9, 'S'); ICard card7 = new Card(2, 'S'); IHand hand = new Hand(); IList <ICard> combination = new List <ICard>() { card1, card2, card3, card4, card5, card6, card7 }; hand.CurrentCards = combination; CardPowerCalculator.GetCurrentStrengthOfCards(hand); Assert.AreEqual(HandStrengthEnum.Flush, hand.Strength); }
/// <summary> /// Bot makes calculations and decides how to play his turn based on several factors /// </summary> /// <param name="currentHighestBet">The current highest bet on the board.</param> /// <param name="playersNotFolded">The number of players not folded.</param> /// <param name="canCheck">if set to <c>true</c> the bot [can check] /// (true only if no one has called or raised before him and the turn part is past the flop).</param> /// <param name="currentPartOfTurn">The current part of the turn.</param> /// <param name="randomBehavior">The random behavior that's one of the factors in the bots decision making.</param> public void PlayTurn(ref int currentHighestBet, int playersNotFolded, bool canCheck, TurnParts currentPartOfTurn, Random randomBehavior) { CardPowerCalculator.GetCurrentStrengthOfCards(this.Hand); int feelingLucky = randomBehavior.Next(0, 100); int bluff = randomBehavior.Next(0, 10); int turnPartFactor = (int)currentPartOfTurn * 40; if (this.CheckShouldRaise(playersNotFolded, turnPartFactor, feelingLucky, bluff)) { this.Raise(currentHighestBet * 2, ref currentHighestBet); } else if (this.CheckShouldCall(playersNotFolded, turnPartFactor, feelingLucky, bluff)) { this.Call(currentHighestBet); } else if (canCheck) { this.Check(); } else { this.Fold(); } }