Android Open Source - DroidSweeper Level






From Project

Back to project page DroidSweeper.

License

The source code is released under:

MIT License

If you think the Android project DroidSweeper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.nisble.droidsweeper.config;
//  ww  w.  ja v a  2 s  .c  om
import de.nisble.droidsweeper.utilities.LogDog;
import static de.nisble.droidsweeper.config.Constants.*;

/** Available difficulty levels.
 * <ul>
 * <li>Immutable: Members are public final and capitalized.</li>
 * <li>Serializable: Do not change this class!</li>
 * </ul>
 * @author Moritz Nisbl moritz.nisble@gmx.de */
public enum Level {
  /** Difficulty level easy.
   * Dimensions and bombs are defined by:
   * <ul>
   * <li>{@link Constants#EASY_X}</li>
   * <li>{@link Constants#EASY_Y}</li>
   * <li>{@link Constants#EASY_BOMBS}</li>
   * </ul> */
  EASY(EASY_X, EASY_Y, EASY_BOMBS),
  /** Difficulty level easy.
   * Dimensions and bombs are defined by:
   * <ul>
   * <li>{@link Constants#NORMAL_X}</li>
   * <li>{@link Constants#NORMAL_Y}</li>
   * <li>{@link Constants#NORMAL_BOMBS}</li>
   * </ul> */
  NORMAL(NORMAL_X, NORMAL_Y, NORMAL_BOMBS),
  /** Difficulty level easy.
   * Dimensions and bombs are defined by:
   * <ul>
   * <li>{@link Constants#HARD_X}</li>
   * <li>{@link Constants#HARD_Y}</li>
   * <li>{@link Constants#HARD_BOMBS}</li>
   * </ul> */
  HARD(HARD_X, HARD_Y, HARD_BOMBS),
  /** Difficulty level easy.
   * Dimensions and bombs are set to 0. */
  CUSTOM(0, 0, 0);

  private static final String CLASSNAME = Level.class.getSimpleName();

  private Level(int x, int y, int b) {
    X = x;
    Y = y;
    BOMBS = b;
  }

  /** The horizontal size of the game grid. */
  public final int X;
  /** The vertical size of the game grid. */
  public final int Y;
  /** The count of bombs. */
  public final int BOMBS;

  /** Get the difficulty level for the corresponding integer.
   * @note Defaults to CUSTOM (3) when index out of bounds.
   * @param i primitive integer (int)
   * @return The difficulty level */
  public static Level fromInt(int i) {
    Level temp;
    try {
      temp = values()[i];
    } catch (Exception e) {
      LogDog.e(CLASSNAME, "Unknown difficulty. Choosing CUSTOM: " + e.getMessage(), e);
      temp = values()[3];
    }
    return temp;
  }
}




Java Source Code List

de.nisble.droidsweeper.config.ApplicationConfig.java
de.nisble.droidsweeper.config.Constants.java
de.nisble.droidsweeper.config.GameConfig.java
de.nisble.droidsweeper.config.Level.java
de.nisble.droidsweeper.game.Field.java
de.nisble.droidsweeper.game.GameObserver.java
de.nisble.droidsweeper.game.Game.java
de.nisble.droidsweeper.game.Position.java
de.nisble.droidsweeper.game.database.DSDBAdapter.java
de.nisble.droidsweeper.game.database.DSDBContract.java
de.nisble.droidsweeper.game.database.DSDBGameEntry.java
de.nisble.droidsweeper.game.database.DSDBHelper.java
de.nisble.droidsweeper.game.jni.FieldListener.java
de.nisble.droidsweeper.game.jni.FieldStatus.java
de.nisble.droidsweeper.game.jni.GameStatus.java
de.nisble.droidsweeper.game.jni.MatrixObserver.java
de.nisble.droidsweeper.game.jni.MineSweeperMatrix.java
de.nisble.droidsweeper.game.replay.PlayerObserver.java
de.nisble.droidsweeper.game.replay.Player.java
de.nisble.droidsweeper.game.replay.Recorder.java
de.nisble.droidsweeper.game.replay.Replay.java
de.nisble.droidsweeper.game.replay.TimeStep.java
de.nisble.droidsweeper.gui.DroidSweeperActivity.java
de.nisble.droidsweeper.gui.HighScoreActivity.java
de.nisble.droidsweeper.gui.HighScoreListAdapter.java
de.nisble.droidsweeper.gui.SettingsActivity.java
de.nisble.droidsweeper.gui.grid.FieldDrawables.java
de.nisble.droidsweeper.gui.grid.FieldView.java
de.nisble.droidsweeper.gui.grid.GameGridView.java
de.nisble.droidsweeper.utilities.LogDog.java
de.nisble.droidsweeper.utilities.Timer.java