public bool winningHand() { // All cards currently being considered bool[] inGroup = new bool[7]; for (int i = 0; i < 7; i++) inGroup[i] = false; // Check to see if 2 groups with the same value if (numDifferentValues(inGroup) == 2) { Console.WriteLine("Winning hand! 2 groups with the same value"); return true; } // Check for sequential runs of 3 or 4 for (int i=0; i<5; i++) { for (int j = 0; j < 7; j++) inGroup[j] = false; if (isRun(hand, i, 4)) { // discard cards in run for (int j = i; j < i + 4; j++) inGroup[j] = true; // Check for a run of 3 if (i == 0) { if (isRun(hand, 4, 3)) { Console.WriteLine("Winning hand! 2 runs"); return true; } } else if (i == 3) { if (isRun(hand, 0, 3)) { Console.WriteLine("Winning hand! 2 runs"); return true; } } // Check remaining cards to see all same value if (numDifferentValues(inGroup) == 1) { Console.WriteLine("Winning hand! A run of 4 and 3 of the same"); return true; } } else if (isRun(hand, i, 3)) { // discard cards in run for (int j = i; j < i + 3; j++) inGroup[j] = true; // Check for a run of 4 if (i == 0) { if (isRun(hand, 3, 4)) { Console.WriteLine("Winning hand! 2 runs"); return true; } } else if (i == 4) { if (isRun(hand, 0, 4)) { Console.WriteLine("Winning hand! 2 runs"); return true; } } // Check remaining cards to see all same value if (numDifferentValues(inGroup) == 1) { Console.WriteLine("Winning hand! A run of 3 and 4 of the same"); return true; } } } return false; } Console.WriteLine("============================================================================\n"); Console.WriteLine(players[currentPlayer].Name + " to play"); // players[currentPlayer].displayHand(); // Console.WriteLine("Drawdeck has " + drawDeck.Size + " and the discard deck has " + discardDeck.Size + " cards"); // Console.WriteLine("Handval " + players[currentPlayer].handValue(players[currentPlayer].Hand)); //Console.WriteLine("Play? (0): "); // string s = Console.ReadLine(); // if (s[0] == '0') { } players[currentPlayer].play(drawDeck,discardDeck); players[currentPlayer].displayHand(); Console.WriteLine("Drawdeck has " + drawDeck.Size + " and the discard deck has " + discardDeck.Size + " cards"); Console.WriteLine("Handval " + players[currentPlayer].handValue(players[currentPlayer].Hand)); // Console.WriteLine("Next player? (0): "); // s = Console.ReadLine(); // if (s[0] == '0') { } private void play() { // Start game with player 0 gameTextBox.Text = players[0].Name + " to play"; currentPlayer = 0; bool gameOver = false; do { if (drawDeck.Size == 0) { // Reshuffle the discard deck which becomes the draw deck do { PlayingCard card1 = discardDeck.drawCard(); drawDeck.addCard(card1); } while (discardDeck.Size > 0); drawDeck.shuffleDeck(); PlayingCard card = drawDeck.drawCard(); discardDeck.addCard(card); // Update the deck panel display updateDeckPanel(); } // Get the card display panel for updating graphics if (currentPlayer == 0) { // Interactive player Panel p = interactivePlayerPanel; // Enable play button int controlIndex = getControlOfType