コード例 #1
0
  /**
   * Gets the game difficulty from the user.
   *
   * @param in : input stream
   * @param out : output stream
   * @return the difficulty
   */
  public int inputGameDifficulty() {

    out.drawMsg(6);

    String s;

    boolean deuMerda = false;

    int value;

    do {

      if (deuMerda) {
        out.drawMsg(5);
        out.drawMsg(69);
      }

      s = in.getString();

      deuMerda = true;

      if (isValid(s)) value = Integer.parseInt(s);
      else value = 0;

    } while (!isBetween(1, 3, value));

    value = Integer.parseInt(s);

    return value;
  }
コード例 #2
0
  /**
   * Gets the dragon percentage from the user.
   *
   * @return
   */
  public double inputDragonperc() {

    out.drawMsg(7);

    String s;

    boolean deuMerda = false;

    int value;

    do {

      if (deuMerda) {
        out.drawMsg(5);
        out.drawMsg(69);
      }

      s = in.getString();

      deuMerda = true;

      if (isValid(s)) value = Integer.parseInt(s);
      else value = 0;

    } while (!isBetween(4, 10, value));

    value = Integer.parseInt(s);

    return (value / 100.0);
  }
コード例 #3
0
  /**
   * Gets the maze size from the user.
   *
   * @param in : input stream
   * @param out : output stream
   * @return the maze size
   */
  public int inputMazeSize() {

    String s;

    out.drawMsg(4);

    boolean deuMerda = false;

    int value;

    do {

      if (deuMerda) {
        out.drawMsg(5);
        out.drawMsg(69);
      }

      s = in.getString();

      deuMerda = true;

      if (isValid(s)) value = Integer.parseInt(s);
      else value = 0;

    } while (!(isBetween(5, 21, value) && isOdd(value)));

    return value;
  }