# aitorbauza/gamecenteraitor architecture

> Architecture diagram of the GitHub repository aitorbauza/gamecenteraitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aitorbauza/gamecenteraitor
- Repository: https://github.com/aitorbauza/gamecenteraitor

## Overview

##### Project Type and Purpose
- This is a single-module Android application (“app” module) that acts as a mobile game center.
- It provides user authentication (LoginActivity, RegisterActivity), two embedded games (2048 and Breakout in different difficulty modes), user stats display, and local data persistence via SQLite.

##### File Structure
- Top-level “app” module contains:
– src/main/java/com/example/formularios: UI Activities, game logic classes (e.g., Ladrillo.java), DBHelper.
– src/main/res: layouts, drawables, animations, XML configs (backup_rules.xml, data_extraction_rules.xml).
– AndroidManifest.xml, ProGuard rules.
- Tests live under src/androidTest and src/test.
- Build and dependency management files: build.gradle, settings.gradle, gradle wrapper files.

##### Extract Key Architecture Insights
- Presentation layer: Activities manage UI & navigation via Intents.
- Game logic layer: separate Java classes for 2048 and Breakout engines.
- Data layer: DBHelper wraps SQLite for users, scores, stats.
- Resource layer: XML layouts, drawables, anims, themes.
- Android framework: Activity Manager, Resource Manager, BackupManager.

a. Main Components
1. Android OS & Framework (bottom layer)
2. App Module
– Presentation Layer (Activities & Fragments)
– Domain/Game Logic Layer (2048Engine, BreakoutEngine)
– Data Layer (DBHelper → SQLite)
– Resource Layer (layouts, drawables, anims, XML rules)
b. Relationships & Interactions
– User taps UI → Activity handles input → Domain layer runs game logic → Data layer persists/retrieves score → UI updates.
– Activities navigate using Intents (e.g., MainActivity → LoginActivity → GamesActivity → Game modes).
– BackupManager reads backup_rules.xml to back up user data.
c. Architectural Patterns
– MVC-style separation: Activities (Controllers), layouts (Views), helper classes + DBHelper (Models).
– Modularization by feature: authentication, game modes, stats.
d. Technologies & Frameworks
– Android SDK (API levels), SQLite, Gradle build system, ProGuard, AndroidX (if used).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User"]:::user

    %% Android Framework & OS
    subgraph "Android Framework & OS"
        AF1["Activity Manager"]:::framework
        AF2["Resource Manager"]:::framework
        AF3["BackupManager"]:::framework
    end

    %% App Module
    subgraph "App Module"
        subgraph "Presentation Layer"
            Main["MainActivity"]:::present
            Login["LoginActivity"]:::present
            Register["RegisterActivity"]:::present
            Games["GamesActivity"]:::present
            Levels2048["Levels2048Activity"]:::present
            Norm2048["Normal2048Activity"]:::present
            Hard2048["Hard2048Activity"]:::present
            LevelsBreak["LevelsBreakoutActivity"]:::present
            NormBreak["BreakoutNormalActivity"]:::present
            HardBreak["BreakoutHardActivity"]:::present
            SOBNorm["SOBreakoutNormalAct"]:::present
            SOBHard["SOBreakoutHardAct"]:::present
            Stats["StatsActivity"]:::present
            Users["UsersActivity"]:::present
        end

        subgraph "Domain/Game Logic Layer"
            Brick["Ladrillo.java"]:::domain
        end

        subgraph "Data Layer"
            DBH["DBHelper"]:::data
            DB["SQLite DB"]:::data
        end

        subgraph "Resource Layer"
            Layouts["Layouts (.xml)"]:::resource
            Drawables["Drawables (.xml)"]:::resource
            Anims["Animations (.xml)"]:::resource
            XMLRules["XML Rules"]:::resource
        end

        subgraph "Config & Build"
            Manifest["AndroidManifest.xml"]:::config
            ProGuard["proguard-rules.pro"]:::config
            AppGradle["app/build.gradle"]:::config
            ProjectGradle["build.gradle & settings.gradle"]:::config
            Wrapper["gradle-wrapper.properties"]:::config
        end

        subgraph "Testing"
            InstrTest["ExampleInstrumentedTest"]:::test
            UnitTest["ExampleUnitTest"]:::test
        end
    end

    %% Interactions
    User --> Main
    Main -->|Intent| Login
    Login -->|Intent| Register
    Login -->|Intent| Games
    Games -->|Intent| Levels2048
    Levels2048 --> Norm2048
    Levels2048 --> Hard2048
    Games -->|Intent| LevelsBreak
    LevelsBreak --> NormBreak
    LevelsBreak --> HardBreak
    LevelsBreak --> SOBNorm
    LevelsBreak --> SOBHard
    Games -->|Intent| Stats
    Games -->|Intent| Users

    Norm2048 --> Brick
    Hard2048 --> Brick
    NormBreak --> Brick
    HardBreak --> Brick
    SOBNorm --> Brick
    SOBHard --> Brick

    Main --> DBH
    Login --> DBH
    Register --> DBH
    Stats --> DBH
    Users --> DBH
    DBH --> DB

    Layouts --> Main
    Drawables --> Main
    Anims --> Main
    XMLRules --> AF3

    AF1 --> Main
    AF2 --> Layouts
    AF3 --> DBH

    AppGradle --> Manifest
    Manifest --> Main

    %% Click Events
    click Main "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/MainActivity.java"
    click Login "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/LoginActivity.java"
    click Register "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/RegisterActivity.java"
    click Games "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/GamesActivity.java"
    click Levels2048 "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/Levels2048Activity.java"
    click Norm2048 "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/Normal2048Activity.java"
    click Hard2048 "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/Hard2048Activity.java"
    click LevelsBreak "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/LevelsBreakoutActivity.java"
    click NormBreak "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/BreakoutNormalActivity.java"
    click HardBreak "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/BreakoutHardActivity.java"
    click SOBNorm "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/SOBreakoutNormalAct.java"
    click SOBHard "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/SOBreakoutHardAct.java"
    click Stats "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/StatsActivity.java"
    click Users "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/UsersActivity.java"
    click Brick "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/Ladrillo.java"
    click DBH "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/java/com/example/formularios/DBHelper.java"
    click Layouts "https://github.com/aitorbauza/gamecenteraitor/tree/master/app/src/main/res/layout/"
    click Drawables "https://github.com/aitorbauza/gamecenteraitor/tree/master/app/src/main/res/drawable/"
    click Anims "https://github.com/aitorbauza/gamecenteraitor/tree/master/app/src/main/res/anim/"
    click XMLRules "https://github.com/aitorbauza/gamecenteraitor/tree/master/app/src/main/res/xml/"
    click Manifest "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/main/AndroidManifest.xml"
    click ProGuard "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/proguard-rules.pro"
    click AppGradle "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/build.gradle"
    click ProjectGradle "https://github.com/aitorbauza/gamecenteraitor/blob/master/build.gradle"
    click Wrapper "https://github.com/aitorbauza/gamecenteraitor/blob/master/gradle/wrapper/gradle-wrapper.properties"
    click InstrTest "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/androidTest/java/com/example/formularios/ExampleInstrumentedTest.java"
    click UnitTest "https://github.com/aitorbauza/gamecenteraitor/blob/master/app/src/test/java/com/example/formularios/ExampleUnitTest.java"

    %% Styles
    classDef user fill:#FFD700,stroke:#333,stroke-width:1px
    classDef framework fill:#CCCCCC,stroke:#333,stroke-width:1px
    classDef present fill:#AED6F1,stroke:#21618C,stroke-width:1px
    classDef domain fill:#A9DFBF,stroke:#196F3D,stroke-width:1px
    classDef data fill:#F9E79F,stroke:#B9770E,stroke-width:1px
    classDef resource fill:#D5DBDB,stroke:#515A5A,stroke-width:1px
    classDef config fill:#EBDEF0,stroke:#7D3C98,stroke-width:1px
    classDef test fill:#F5B7B1,stroke:#C0392B,stroke-width:1px
```
