Пример #1
0
  /**
   * Determines who won the round. Warning: this makes the computer choose its current state, so
   * subsequent calls may not have the same result.
   *
   * @return the string representing who won, the Computer, Player, or a Tie
   */
  public String getWinner() {
    numGames++;
    int result = winSelector.compare(player.getHand(), computer.getHand());
    if (result < 0) {
      return "Computer";
    } else if (result > 0) {
      playerWin++;
      return "Player";

    } else {
      return "Tie";
    }
  }
Пример #2
0
 /** @param s the hand the player throws */
 public void setPlayerHand(HandSymbol s) {
   player.setHand(s);
 }