/**
   * Called before getQuestionIterator to set its size and initialize it
   *
   * @param numberOfDoors - the number of questions needed for the current game
   */
  public void initializeQuestionHashMap(int numberOfDoors) {

    questionCount = numberOfDoors;
    int i = 0;

    if (questionHashMap != null) {
      questionHashMap.clear();
    }

    questionHashMap = new HashMap<Integer, MazeQuestion>(numberOfDoors);

    MazeQuestion newQuestionToAdd;
    Integer newQuestionKey;

    if (TriviaMaze.DEMO) {
      if (numberOfDoors < 4) {
        throw new RuntimeException("there must be at least 4 doors to run the demo");
      }
      i = 3;
      newQuestionToAdd =
          new MazeQuestion(
              196,
              'm',
              'v',
              "Who is dodging punches in the video? a. Muhammad Ali b. George Foreman c. Mike Tyson d. Raging Bull",
              "a",
              "srs/maze/mp4/0001.mp4");
      newQuestionKey = newQuestionToAdd.getQuestionID();
      questionHashMap.put(newQuestionKey, newQuestionToAdd);
      newQuestionToAdd =
          new MazeQuestion(
              192,
              'm',
              's',
              "What sort of bird makes this call? a. Ostrich b. Albatross c. Raven d. Robin",
              "d",
              "src/maze/mp3/0001.mp3");
      newQuestionKey = newQuestionToAdd.getQuestionID();
      questionHashMap.put(newQuestionKey, newQuestionToAdd);
      newQuestionToAdd =
          new MazeQuestion(
              194,
              'm',
              's',
              "Who composed this piece? a. Wolfgang Amadeus Mozart b. Bob Dylan c. Johann Sebastian Bach d. Madonna",
              "c",
              "src/maze/mp3/0002.mp3");
      newQuestionKey = newQuestionToAdd.getQuestionID();
      questionHashMap.put(newQuestionKey, newQuestionToAdd);
      newQuestionToAdd =
          new MazeQuestion(
              195,
              'm',
              's',
              "What school's fight song is this from? a. MIT b. Yale c. Notre Dame d. USC",
              "c",
              "src/maze/mp3/0003.mp3");
      newQuestionKey = newQuestionToAdd.getQuestionID();
      questionHashMap.put(newQuestionKey, newQuestionToAdd);
    }

    for (; i < questionCount; i++) {
      newQuestionToAdd = uniqueInstance.getNewQuestion();
      newQuestionKey = newQuestionToAdd.getQuestionID();
      questionHashMap.put(newQuestionKey, newQuestionToAdd);
    } // end for loop i
    Set<Integer> setOfKeys = questionHashMap.keySet();
    List<MazeQuestion> collectionOfQuestions =
        new ArrayList<MazeQuestion>(questionHashMap.values());
    Collections.shuffle(collectionOfQuestions);

    HashMap<Integer, MazeQuestion> shuffledQuestionHashMap =
        new HashMap<Integer, MazeQuestion>(numberOfDoors);
    Iterator<MazeQuestion> questionIterator = collectionOfQuestions.iterator();
    for (Integer integer : setOfKeys) {
      shuffledQuestionHashMap.put(integer, questionIterator.next());
    }
    questionHashMap = shuffledQuestionHashMap;
  }