private void playRound(String playerTurn) { Card topCard = playedDeck.getTopCard(); Card drawnCard; Card cardToPlay; int newSuit; boolean draw = false; for (int i = 0; i < numPlayers; i++) { if (player[i].getName() == playerTurn){ draw = player[i].playTurn(topCard); if (!draw) { drawnCard = deck.getCard(); player[i].insertCardInHand(drawnCard); } else { cardToPlay = player[i].selectCard(topCard); if (cardToPlay.getRank() == 8) { newSuit = player[i].chooseSuit(); topCard = new Card(newSuit, 8); System.out.println(topCard.getSuit()); } playedDeck.playCard(cardToPlay); } if (player[i].getHand().getNumCards() == 0) { win = true; } else { if (i + 1 < numPlayers) playerTurn = player[i+1].getName(); topCard = playedDeck.getTopCard(); } } } }
public Card getCard() { // 'Deals' one card from the top of the deck, card is not deleted //pre: deck is not empty return deck[top--]; }