Skip to content

Feature/hibboo#1

Merged
venopyX merged 8 commits intomainfrom
feature/hibboo
Mar 6, 2025
Merged

Feature/hibboo#1
venopyX merged 8 commits intomainfrom
feature/hibboo

Conversation

@venopyX
Copy link
Copy Markdown
Owner

@venopyX venopyX commented Mar 6, 2025

Feature: Hibboo Language Learning Game

Overview

This PR adds the new Hibboo language learning mini-game to QubeeGames, expanding my educational offerings with an interactive traditional Oromo word-based puzzle experience that combines learning with visual growth progression.

Feature Details

🎮 Hibboo Game Mechanics

  • Word-based puzzles presented in question-answer format
  • Interactive hint system with scrambled letters
  • Custom UI designed to match QubeeGames style

📈 Progress & Achievement System

  • 5-level progression system with visual representation
  • Achievement tracking for users reaching 85+ correct answers
  • Growth points system that ties into visual tree evolution

🌱 Visual Growth Representation

  • Animated tree that evolves through 5 distinct stages:
    • Level 1: Seedling
    • Level 2: Sapling
    • Level 3: Young Tree
    • Level 4: Mature Tree
    • Level 5: Grand Tree
  • Special visual effects for higher-level achievements

🧠 Educational Approach

  • Implemented lenient answer matching to improve learning curve
  • Success dialogs showing both user's answer and correct spelling
  • Detailed feedback to enhance vocabulary retention

Implementation Notes

  • Feature follows QubeeGames' clean architecture pattern
  • Maintains consistent styling with existing mini-games
  • Built using Provider for state management
  • Designed for easy extension with additional word sets

Testing

  • Tested on various device sizes for responsive layout
  • Verified answer validation logic with edge cases
  • Confirmed achievement unlocking and progress tracking

This feature expands QubeeGames' educational value by introducing a new way for users to learn vocabulary while enjoying visual progress feedback, complementing our existing game collection.

PR by: venopyX
Date: 2025-03-06 13:39:51 UTC

Summary by Sourcery

Adds a Hibboo language learning mini-game to QubeeGames, featuring word-based puzzles, a visual growth progression system, and achievement tracking.

New Features:

  • Introduces the Hibboo language learning mini-game with word-based puzzles in a question-answer format.
  • Implements a 5-level progression system with a visual representation of a growing tree.
  • Adds an achievement tracking system for users reaching 85+ correct answers.
  • Provides an interactive hint system with scrambled letters to assist users.
  • Includes success dialogs that display both the user's answer and the correct spelling to enhance vocabulary retention.
  • Features a growth points system that ties into the visual tree evolution.
  • Presents an animated tree that evolves through five distinct stages, from seedling to grand tree, providing visual feedback on progress.
  • Offers lenient answer matching to improve the learning curve.

Tests:

  • Adds tests for responsive layout across various device sizes.
  • Verifies answer validation logic with edge cases.
  • Confirms achievement unlocking and progress tracking.

The data model class to use level instead of stage.
Any code that references the old stage field to use level instead.
Accepts answers that are 'close enough' to the correct answer (based on the Levenshtein edit distance)
Shows the user their input along with the correct spelling in the success dialog
Visually differentiates between exact matches and close-enough matches
Still gives the user points for answers that are close enough
Removes the dashboard related codes since there is home
@venopyX venopyX added the enhancement New feature or request label Mar 6, 2025
@venopyX venopyX self-assigned this Mar 6, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 6, 2025

Reviewer's Guide by Sourcery

This pull request introduces the Hibboo language learning game to QubeeGames. It includes the game logic, UI, state management, and data persistence. The game presents word-based puzzles in a question-answer format, provides hints, and tracks user progress with a visual tree evolution. The implementation follows a clean architecture pattern and uses Provider for state management.

Sequence diagram for solving a Hibboo puzzle

sequenceDiagram
    participant User
    participant HibbooPlayingPage
    participant HibbooProvider
    participant Hibboo

    User->>HibbooPlayingPage: Enters answer and submits
    HibbooPlayingPage->>HibbooProvider: checkAnswer(userAnswer)
    HibbooProvider->>Hibboo: get correctAnswer
    alt userAnswer == correctAnswer
        HibbooProvider->>HibbooProvider: _growthPoints += 10, _correctAnswers += 1
        HibbooProvider->>HibbooProvider: _currentIndex++
        HibbooProvider-->>HibbooPlayingPage: isCorrect = true
        HibbooPlayingPage->>User: Show success dialog
    else userAnswer is close enough to correctAnswer
        HibbooProvider->>HibbooProvider: _growthPoints += 10, _correctAnswers += 1
        HibbooProvider->>HibbooProvider: _currentIndex++
        HibbooProvider-->>HibbooPlayingPage: isCorrect = false, isCloseEnough = true
        HibbooPlayingPage->>User: Show success dialog with correct spelling
    else
        HibbooProvider-->>HibbooPlayingPage: isCorrect = false
        HibbooPlayingPage->>User: Show error effect
    end
Loading

Updated class diagram for Hibboo game

classDiagram
    class Hibboo {
        String text
        String answer
        int level
    }
    class HibbooModel {
        String text
        String answer
        int level
        +fromJson(Map data) HibbooModel
        +toJson() Map
    }
    class HibbooDatasource {
        +getHibbooList() Future<List<HibbooModel>>
    }
    class HibbooRepositoryImpl {
        +getHibbooList() Future<List<Hibboo>>
    }
    class GetHibbooList {
        +call() Future<List<Hibboo>>
    }
    class HibbooProvider {
        List<Hibboo> hibbooList
        int currentIndex
        int growthPoints
        int correctAnswers
        +loadHibbooList() Future<void>
        +solveAndAdvance() Hibboo
        +getHibboosByLevel(int level) List<Hibboo>
        +resetAchievement() void
    }

    Hibboo <.. HibbooModel : maps to
    HibbooRepositoryImpl ..> HibbooDatasource : uses
    GetHibbooList ..> HibbooRepositoryImpl : uses
    HibbooProvider ..> GetHibbooList : uses
    note for HibbooProvider "Manages the state of the Hibboo game"
    note for Hibboo "Represents a Hibboo puzzle"
    note for HibbooModel "Data model for Hibboo puzzle"
    note for HibbooDatasource "Fetches Hibboo data from a data source"
    note for HibbooRepositoryImpl "Implements the Hibboo repository interface"
    note for GetHibbooList "Use case for getting the list of Hibboo puzzles"
Loading

File-Level Changes

Change Details Files
Implements the core game logic, including answer checking with a lenient matching system, success/error feedback, and hint generation.
  • Added a function to check answers, incorporating a Levenshtein distance calculation for lenient matching.
  • Implemented success and error feedback mechanisms using dialogs and snack bars.
  • Created a hint system that scrambles the letters of the correct answer.
  • Added confetti animation on correct answer.
  • Added tree growth animation based on user progress.
lib/features/hibboo/presentation/pages/hibboo_playing_page.dart
Introduces a dashboard page with a visual representation of the user's progress in the game.
  • Displays a tree that evolves through 5 stages based on the user's growth points.
  • Shows the current level and a progress bar indicating progress towards the next level.
  • Includes a play button to start the game.
  • Displays an achievement progress bar.
lib/features/hibboo/presentation/pages/hibboo_dashboard_page.dart
Creates a custom widget for rendering the evolving tree.
  • Defines a TreeWidget that takes a stage and growth points as input.
  • Animates the tree's sway and adds sparkles to indicate growth.
  • Uses different trunk and leaf sizes and colors based on the tree's stage.
  • Includes a sky background with animated clouds.
lib/features/hibboo/presentation/widgets/tree_widget.dart
Adds a provider for managing the game state.
  • Manages the list of Hibboo questions, the current question index, growth points, and correct answer count.
  • Includes methods for loading the Hibboo list, solving a Hibboo, and advancing to the next question.
  • Calculates the current stage based on the user's growth points.
  • Tracks whether the user has unlocked an achievement.
lib/features/hibboo/presentation/providers/hibboo_provider.dart
Adds data models for Hibboo questions.
  • Defines a HibbooModel with text, answer, and level properties.
  • Includes methods for converting between JSON and HibbooModel objects.
lib/features/hibboo/data/models/hibboo_model.dart
Adds data sources for Hibboo questions.
  • Implements a HibbooDatasource that loads the Hibboo list from a JSON file.
  • Includes a method for parsing the JSON data into a list of HibbooModel objects.
lib/features/hibboo/data/datasources/hibboo_datasource.dart
Adds data repositories for Hibboo questions.
  • Implements a HibbooRepositoryImpl that uses the HibbooDatasource to retrieve the Hibboo list.
  • Includes a method for converting the HibbooModel objects into Hibboo objects.
lib/features/hibboo/data/repositories/hibboo_repository_impl.dart
Adds domain use cases for Hibboo questions.
  • Implements a GetHibbooList use case that uses the HibbooRepository to retrieve the Hibboo list.
lib/features/hibboo/domain/usecases/get_hibboo_list.dart
Adds domain entities for Hibboo questions.
  • Defines a Hibboo entity with text, answer, and level properties.
lib/features/hibboo/domain/entities/hibboo.dart
Adds domain repositories for Hibboo questions.
  • Defines a HibbooRepository abstract class with a method for retrieving the Hibboo list.
lib/features/hibboo/domain/repositories/hibboo_repository.dart
Configures the application routes.
  • Defines named routes for the Hibboo dashboard and playing pages.
  • Includes a method for generating routes based on the route settings.
lib/app/routes/app_routes.dart
Sets up dependency injection using Provider.
  • Configures the HibbooProvider and its dependencies.
  • Provides the HibbooProvider to the application.
lib/app/di/setup.dart
Integrates the Hibboo game into the main application.
  • Adds a button to the home page that navigates to the Hibboo dashboard.
  • Updates the main application widget to use the Provider for state management.
lib/app/app.dart
lib/features/home/presentation/pages/home_page.dart
lib/main.dart
Adds a JSON file containing the Hibboo questions.
  • Includes the text, answer, and level for each question.
assets/hibboo.json
Updates the pubspec file.
  • Adds dependencies for provider and flutter_animate.
  • Configures the assets folder.
pubspec.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@venopyX venopyX merged commit ca0bd6c into main Mar 6, 2025
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @venopyX - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a navigation bar to the bottom of the home page for easier access to different sections of the app.
  • The tree widget could be made more generic by allowing the user to pass in custom trunk and leaf colors.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

int get growthPoints => _growthPoints;
int get correctAnswers => _correctAnswers; // Getter for correct answers
bool get isLoading => _hibbooList.isEmpty;
bool get hasAchievement => _correctAnswers >= 65; // Achievement unlocked at 85+ correct answers
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Inconsistent achievement threshold value.

The getter returns true when _correctAnswers is 65 or more, yet other parts of the UI and text indicate a requirement of 85 correct answers. Consider aligning this threshold to avoid user confusion.

Suggested change
bool get hasAchievement => _correctAnswers >= 65; // Achievement unlocked at 85+ correct answers
bool get hasAchievement => _correctAnswers >= 85; // Achievement unlocked at 85+ correct answers

),
),

if (widget.showSparkles)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Sparkle animation controller is not started.

The _sparkleController is instantiated but never started (e.g., via forward() or repeat()), so the FadeTransition may not animate as expected. Consider triggering the animation in initState or when showSparkles is true.

Suggested implementation:

  @override
  void initState() {
    super.initState();
    _sparkleController = AnimationController(vsync: this, duration: const Duration(milliseconds: 800));
    if (widget.showSparkles) {
      _sparkleController.repeat(reverse: true);
    }

  @override
  void didUpdateWidget(covariant TreeWidget oldWidget) {
    super.didUpdateWidget(oldWidget);
    if (widget.showSparkles && !oldWidget.showSparkles) {
      _sparkleController.repeat(reverse: true);
    } else if (!widget.showSparkles && oldWidget.showSparkles) {
      _sparkleController.stop();
    }
  }

Make sure that _sparkleController is disposed in the dispose() method if not already implemented:

@OverRide
void dispose() {
_sparkleController.dispose();
super.dispose();
}
Adjust the AnimationController duration or behavior if necessary to match the desired animation effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant