Esempio n. 1
0
  /**
   * Creates a new game object. If no game or pack is specified, use -1
   *
   * @param game The game id, or -1
   * @param pack The pack id, or -1
   * @param context
   * @throws Exception
   */
  public Game(int game, int pack, Context context) throws Exception {

    gameId = game;
    packId = pack;
    mContext = context;
    dbHelper = new MishMashDB(mContext, MishMashDB.DB_NAME, null, MishMashDB.latestVersion);
    if (!dbHelper.getGame(this)) {
      throw new Exception("No more games!");
    }

    solutionArr = solution.toCharArray();
    puzzleArr = new char[solutionArr.length];
    answerArr = new char[solutionArr.length];

    createGame();
  }
Esempio n. 2
0
 protected void finishGame() {
   // TODO remove game from active table if it's there
   dbHelper.removeActiveGame(this);
   dbHelper.markGameWon(this);
 }