Exemple #1
0
  /**
   * 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);
      }
    }
  }
Exemple #2
0
  /**
   * 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;
    }
  }