protected bool isNotSplitted = true; // Is player hand not splited. We can split the hand only one time. public Player(byte dealersFirst, uint money, Decks playingDecks, uint wager = 0) { Money = money; FirstWager = wager; Money -= FirstWager; PlayersDecisions = new Decisions[21]; PlayingDecks = new Decks(); PlayingDecks = playingDecks; for (int i = 0; i < 21; i++) { PlayersDecisions[i] = 0; } dealerCard = dealersFirst; FirstHand = new byte[21]; for (int i = 2; i < 21; i++) { FirstHand[i] = 0; } SecondHand = new byte[21]; for (int i = 0; i < 21; i++) { SecondHand[i] = 0; } FirstHand[0] = PlayingDecks.GetCard(); FirstHand[1] = PlayingDecks.GetCard(); FirstSum = 0; SecondSum = 0; }
public void GetCardTest() { Decks playingDecks = new Decks(); byte[] playingCards = new byte[416]; byte[] cardsAfterTest = new byte[416]; playingDecks.FillCards(); for (int i = 0; i < 416; i++) { playingCards[i] = playingDecks.Cards[i]; } byte firstCard = 0, secondCard = 0, thirdCard = 0; firstCard = playingCards[0]; secondCard = playingCards[1]; thirdCard = playingCards[2]; for (int i = 0; i < 3; i++) { playingCards[i] = 0; } byte functionFirstValue = playingDecks.GetCard(); byte functionSecondValue = playingDecks.GetCard(); byte functionThirdValue = playingDecks.GetCard(); Assert.AreEqual(firstCard, functionFirstValue); Assert.AreEqual(secondCard, functionSecondValue); Assert.AreEqual(thirdCard, functionThirdValue); for (int i = 0; i < 416; i++) { cardsAfterTest[i] = playingDecks.Cards[i]; } for (int i = 0; i < 416; i++) { Assert.AreEqual(playingCards[i], cardsAfterTest[i]); } }