public static void startNextGame() { // take cards from dealer and players and add to discard pile TableDealer.reset(); Players.ForEach(player => player.reset()); // if active deck has less than shuttle trigger value, // reset discard deck and active deck if (ActiveDeck.getCount() < Settings.ActiveDeckReshuffleTarget) { ActiveDeck = new ActiveDeck(); ActiveDeck.createDeck(); updateActiveDeckCount(); DiscardDeck = new DiscardDeck(); updateDiscardDeckCount(); } // reset game status GameStatus = GameStatusEnum.InProgress; PlayerTurnIndex = 0; // retoggle visibility handlers DealerHandVisibility = Visibility.Hidden; NextGameControlsVisibility = Visibility.Hidden; ActiveGameControlsVisibility = Visibility.Visible; // deal initial hand dealInititalHand(); }
public void RandomCardDraw_ReturnsVoid() { // Arrange const int CARDS_DRAWN = 3; List <List <Card> > drawSeq = new List <List <Card> >(); // Act for (int i = 0; i < 2; i++) { drawSeq.Add(new List <Card>()); ActiveDeck activeDeck = new ActiveDeck(); activeDeck.createDeck(); // creates a fresh deck of 52 cards of the same sequence // draw 3 cards for (int j = 0; j < CARDS_DRAWN; j++) { drawSeq[i].Add(activeDeck.drawCard()); } } // determine sequencing bool equalSequence = true; for (int cardSequence = 0; cardSequence < CARDS_DRAWN; cardSequence++) { if (drawSeq[0][cardSequence].getId() != drawSeq[1][cardSequence].getId()) { equalSequence = false; break; } } // Assert Assert.IsFalse(equalSequence); }
public void Create52CardDeck_ReturnsVoid() { // Arrange ActiveDeck activeDeck = new ActiveDeck(); // Act activeDeck.createDeck(); // Assert Assert.AreEqual(52, activeDeck.getCount()); }
public void CreateMultipleDeck_ReturnsVoid() { // Arrange const int NumberOfDecks = 3; ActiveDeck activeDeck = new ActiveDeck(); // Act activeDeck.createDeck(NumberOfDecks); // Assert Assert.AreEqual(52 * NumberOfDecks, activeDeck.getCount()); }
// Game play methods // ---------- public static void startNewGame() { // get dealer and players to subscribe to game state events TableDealer.subscribeToGameStateEvents(); Players.ForEach(player => player.subscribeToGameStateEvents()); // create active deck ActiveDeck.createDeck(Settings.NumberOfDecks); updateActiveDeckCount(); // deal initial hand dealInititalHand(); }