Skip to content

๐Ÿง  Difficulty Setting

Users can choose their preferred difficulty level, which directly affects the types of questions they receive in the game.


๐ŸŽฏ Purpose

Allow users to play at a level that suits their skills:

  • SIMPLE โ€“ For beginners or kids.
  • CHALLENGING โ€“ For advanced learners looking for tough problems.

๐Ÿง‘โ€๐Ÿซ Available Levels

Defined in the Difficulty enum:

  • SIMPLE
  • EASY
  • MEDIUM
  • HARD
  • CHALLENGING

These levels can be expanded or renamed as needed.


๐Ÿง  How It Works

  1. When the user selects a level, itโ€™s saved using:

```kotlin DifficultyPreferences.setDifficulty(context, level) ````

  1. To retrieve the current level anywhere in the app:

kotlin val level = DifficultyPreferences.getDifficulty(context)

  1. Game fragments (like Tap Mode, Shake Mode) use this level to load questions dynamically based on difficulty.

๐Ÿ” Persistence

The selected difficulty is stored in SharedPreferences under this key:

pref_difficulty_level