public void addDeck(Deck hand) { this.hand = hand; // change to hand instead of playerHand// System.out.println("player1" + hand.toString() + "size" + hand.getCardsLeft()); System.out.println("player2" + hand.toString() + "size" + hand.getCardsLeft()); }
/** * Every player sould take four cards when the game begins. * * @return ArrayList<Card> */ private ArrayList<Card> takeFourCards() { ArrayList<Card> cardsToDeal = new ArrayList<Card>(); if (deck.amountOfCards() >= 4) { for (int i = 0; i < 4; i++) { cardsToDeal.add(deck.getCards().get(i)); } deck.getCards().removeAll(cardsToDeal); } return cardsToDeal; }
/** * Counts every players card scores and return false if game has ended. * * @return boolean */ public boolean newRound() { table.removeCardsFromTable(); cp.valueCards(0, player.getPointsCard()); for (int i = 0; i < computersPlayer.size(); i++) { cp.valueCards(i + 1, computersPlayer.get(i).getPointsCard()); } cp.roundEnd(); boolean gameEnded = cp.gameEnded(); if (gameEnded == false) { deck.newRound(); dealNewCards(); } if (gameEnded == false) { return true; } else { return false; } }
/** * Returns amount of cards in deck. * * @return int */ public int getDeckAmountCards() { return deck.amountOfCards(); }