How fdp-01-2025/project-real-c-pluh-pluh works
Project Type and Purpose
• This is a standalone C++ console game (“Pokemon game”) following a layered architecture.
• The “controllers” directory implements the presentation and application workflows (user input, game mode selection, match flow).
• The “src” directory contains the core game engine (domain logic, entities, enums).
• Utilities live under “utils” (printing, base routines).
• Resources (e.g., PokemonNames.txt) are simple data files loaded at runtime.
Major Components
a. Presentation/Application Layer (controllers + main.cpp)
• main.cpp – entry point; initializes the game, parses arguments.
• controllers/… – orchestrates game flow: loader, game modes, match controllers, entity controllers (createMatch, selectPokemon, attack).
b. Domain Layer (src/game + src/enums)
• Entities: matchControllers, selectPokemon, attack, singlePlayerMode, etc.
• Enums: game modes, attack types, Pokemon types.
• Interfaces: loader.h, game.h define abstractions for loading data and running the game loop.
c. Infrastructure Layer (utils)
• base.cpp/.h – common utilities.
• printCentered.cpp/.h – console formatting helpers.
d. Data Layer
• PokemonNames.txt – external resource loaded by loader.
e. Build/Deployment
• compile.txt – build instructions; result is pokemonGame.exe.
• .vscode folder – IDE settings (launch, tasks).
Relationships and Data Flow
• User invokes pokemonGame.exe → main.cpp initializes Controller.
• Controller calls Loader → reads PokemonNames.txt into in-memory structs.
• Controller selects mode (single vs. test) → instantiates appropriate mode controllers.
• Controllers invoke Domain APIs (src/game/*.h) to mutate game state, resolve attacks, update matches.
• Domain logic uses Enums and Structs (src/enums, src/game/entities/structs).
• Throughout execution, Utility layer is called to print UI to console.
Architectural Patterns and Design Principles
• Layered architecture (Presentation → Application → Domain → Infrastructure).
• Separation of concerns: “controllers” handle workflows, “src” handles pure logic, “utils” for cross‐cutting concerns.
• File‐based configuration/resource loading (single resource file for Pokemon names).
Detailed Component Breakdown (to include
• Presentation/Application: main.cpp, controllers/loader.cpp, selectGameMode.cpp, game.cpp, singleMode/*, entities/match/*, entities/pokemon/*.
• Domain: src/game/game.h, src/game/selectGameMode.h, src/game/singleMode/*.
• Enums/Data Structures: src/enums/*.h, src/game/entities/structs.h.
• Utilities: utils/base.h, utils/printCentered.h.
• Resource: controllers/entities/pokemon/PokemonNames.txt.
• Build: compile.txt → pokemonGame.exe.