/** * Deals new cards to all players. * * @return boolean */ public boolean dealNewCards() { boolean enough = checkEnoughCardsInDeck(getDeckAmountCards()); if (enough == true) { player.newCards(takeFourCards()); for (Player computer : computersPlayer) { computer.newCards(takeFourCards()); } } return enough; }
/** * PlayerHuman sends card he want to lay on table, and computers lays cards automatically. * * @param card */ public void layCards(Card card) { player.cardOnTable(card); if (table.getNumberOfCards() == 0) { cp.addOnePoint(0); } for (int i = 0; i < computersTable.size(); i++) { computersTable.get(i).cardOnTable(); if (table.getNumberOfCards() == 0) { // Player has index 0 cp.addOnePoint(i + 1); } } }
/** * 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 HumanPlayer hand * * @return ArrayList<Card> */ public ArrayList<Card> showPlayerHand() { return player.showHand(); }