public void IndexTest() { float expectedIndex = ((float)33) / ((float)13); TenCountStrategy player = new TenCountStrategy(); Deck deck = new Deck(52); List <Card> burntCards = new List <Card>(); List <Card> deckToCardsList = deck.Cards.ToList(); burntCards.Add(new Card(Suit.Club, Face.King)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.King); burntCards.Add(new Card(Suit.Club, Face.Ten)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Ten); burntCards.Add(new Card(Suit.Club, Face.Queen)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Queen); burntCards.Add(new Card(Suit.Club, Face.Nine)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Nine); burntCards.Add(new Card(Suit.Club, Face.Five)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Five); burntCards.Add(new Card(Suit.Club, Face.Ace)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Ace); deck.Cards.Clear(); foreach (var card in deckToCardsList) { deck.Cards.Push(card); } player.hand.SetHandValues(); int count = player.UpdateCount(deck, burntCards, null).First(); float index = player.GetOthersOverTenRatio(); Assert.AreEqual(expectedIndex, index); }
public void BetMinTest() { int expectedBet = 2; Player player = new TenCountStrategy(); Deck deck = new Deck(52); List <Card> burntCards = new List <Card>(); List <Card> deckToCardsList = deck.Cards.ToList(); burntCards.Add(new Card(Suit.Club, Face.Ten)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Ten); burntCards.Add(new Card(Suit.Spade, Face.Ten)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Spade && x.Face == Face.Ten); burntCards.Add(new Card(Suit.Club, Face.Jack)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Jack); burntCards.Add(new Card(Suit.Spade, Face.Jack)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Spade && x.Face == Face.Jack); burntCards.Add(new Card(Suit.Club, Face.Queen)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Queen); burntCards.Add(new Card(Suit.Spade, Face.Queen)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Spade && x.Face == Face.Queen); deck.Cards.Clear(); foreach (var card in deckToCardsList) { deck.Cards.Push(card); } player.hand.SetHandValues(); player.UpdateCount(deck, burntCards, null).First(); int bet = player.CalculateBet(2, 10); Assert.AreEqual(expectedBet, bet); }
public void CountTest() { int expectedCount = 13; Player player = new TenCountStrategy(); Deck deck = new Deck(52); List <Card> burntCards = new List <Card>(); List <Card> deckToCardsList = deck.Cards.ToList(); burntCards.Add(new Card(Suit.Club, Face.King)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.King); burntCards.Add(new Card(Suit.Club, Face.Ten)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Ten); burntCards.Add(new Card(Suit.Club, Face.Queen)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Queen); burntCards.Add(new Card(Suit.Club, Face.Nine)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Nine); burntCards.Add(new Card(Suit.Club, Face.Five)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Five); burntCards.Add(new Card(Suit.Club, Face.Ace)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Ace); deck.Cards.Clear(); foreach (var card in deckToCardsList) { deck.Cards.Push(card); } player.hand.SetHandValues(); int count = player.UpdateCount(deck, burntCards, null).Last(); Assert.AreEqual(expectedCount, count); }