public void BetMinTest() { int expectedBet = 2; Player player = new CompletePointCountStrategy(); 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 HardStandingNonShadedTest() { PlayerState expectedState = PlayerState.Hit; CompletePointCountStrategy player = new CompletePointCountStrategy { Chips = 500, hand = new Hand { cards = new List <Card>() { new Card(Suit.Club, Face.Ten), new Card(Suit.Diamond, Face.Four) } }, Count = new List <int>() { 50, 100 } //Count = 30 }; player.UpdateIndex(); player.hand.SetHandValues(); PlayerState state = (player.React(dealersUpCard: new Card(Suit.Spade, Face.Nine), ref player.CurrentState, player.hand, new List <int>())); Assert.AreEqual(expectedState, state); }
public void IndexTest() { float expectedIndex = 2.173913f; CompletePointCountStrategy player = new CompletePointCountStrategy(); Deck deck = new Deck(52); List <Card> burntCards = new List <Card>(); List <Card> deckToCardsList = deck.Cards.ToList(); burntCards.Add(new Card(Suit.Club, Face.Two)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Two); 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.Ace)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Ace); 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.Three)); deckToCardsList.RemoveAll(x => x.Suit == Suit.Club && x.Face == Face.Three); 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.GetIndex(); Assert.AreEqual(expectedIndex, index); }
public void SoftStandingShadedTest() { PlayerState expectedState = PlayerState.Stand; CompletePointCountStrategy player = new CompletePointCountStrategy { Chips = 500, hand = new Hand { cards = new List <Card>() { new Card(Suit.Club, Face.Ace), new Card(Suit.Diamond, Face.Seven) } }, Count = new List <int>() { -40, 100 } //Count = 0.01 }; player.UpdateIndex(); player.hand.SetHandValues(); PlayerState state = (player.React(dealersUpCard: new Card(Suit.Spade, Face.Eight), ref player.CurrentState, player.hand, new List <int>())); Assert.AreEqual(expectedState, state); }
public void PairSplittingLessThanTest() { PlayerState expectedState = PlayerState.Split; CompletePointCountStrategy player = new CompletePointCountStrategy { Chips = 500, hand = new Hand { cards = new List <Card>() { new Card(Suit.Club, Face.Seven), new Card(Suit.Diamond, Face.Seven) } }, Count = new List <int>() { -30, 100 } //Count = 1.6 }; player.UpdateIndex(); player.hand.SetHandValues(); PlayerState state = (player.React(dealersUpCard: new Card(Suit.Spade, Face.Two), ref player.CurrentState, player.hand, new List <int>())); Assert.AreNotEqual(expectedState, state); }
public void HardDoublingEqualToTest() { PlayerState expectedState = PlayerState.DoubleDown; CompletePointCountStrategy player = new CompletePointCountStrategy { Chips = 500, hand = new Hand { cards = new List <Card>() { new Card(Suit.Club, Face.Six), new Card(Suit.Club, Face.Two) } }, Count = new List <int>() { 22, 100 } //Count = 22 }; player.UpdateIndex(); player.hand.SetHandValues(); PlayerState state = (player.React(dealersUpCard: new Card(Suit.Club, Face.Three), ref player.CurrentState, player.hand, new List <int>())); Assert.AreNotEqual(expectedState, state); }