A robust, modular implementation of the classic dice game "Generala", developed in C++ with a strong focus on software engineering principles, portability, and technical documentation.
Gameplay demo: selective rerolls, dice animations depending on relevant dice, and Generala detection logic (and scoring).
• Native Cross-Platform: Designed to compile and run seamlessly on both Windows (CMD/Powershell) and Linux (Bash/Terminal).
• Game Modes: Supports Single Player (Solo) and Local Multiplayer (Versus).
• Terminal User Interface (TUI):
o Utilizes the rlutil library for dynamic console manipulation and coloring.
o Real-time dice animations using ASCII/Unicode art.
o Bilingual Support: Dynamic in-game language switching (English/Spanish).
• Debug Mode: Integrated developer tool for manual dice selection and logic testing.
This project goes beyond simple game logic, addressing low-level engineering challenges:
• Memory Management & UB Mitigation: Resolved critical logic errors by strictly initializing primitive variables and controlling execution flows to prevent Undefined Behavior across different compilers (GCC/MinGW).
• Input Buffer Hygiene: Implemented robust "buffer hygiene" logic using cin.ignore() and std::flush to synchronize input behavior between Windows and Linux environments, preventing "phantom reads" caused by residual newline characters.
• Pass-by-Reference Optimization: Systematic use of const std::string& and references to minimize memory copying overhead and improve performance.
• Cross-Platform UTF-8 Encoding: Configured Windows API (SetConsoleOutputCP) to ensure correct rendering of special characters, maintaining visual parity with Linux systems.
The codebase follows a modular architecture to ensure maintainability and scalability:
• main.cpp: Entry point and main menu management.
• game.cpp / .h: Core game loop, turn logic, and rules enforcement.
• game_utils.cpp / .h: Helper functions for sorting algorithms, combination validation, and math.
• ui_utils.cpp / .h: Presentation layer, rendering engines, and animations.
The project includes comprehensive documentation generated via Doxygen and Graphviz.
• Call Graphs: Visual representation of function hierarchy and modularity.
• Dependency Graphs: illustrating the file structure and include relationships.
Note: Pre-compiled binaries are provided for convenience. If your antivirus flags the Windows version, it is a false positive common with MinGW-compiled files without digital signatures. You can always build from source for 100% transparency.
You need a C++ compiler installed on your system.
- Windows: MinGW (g++) or similar.
- Linux: GCC (g++).
Clone the repository:
git clone https://github.com/Gui2Barbieri/Generala-Cpp.git
cd Generala-CppWindows (PowerShell / CMD)
g++ -o generala.exe main.cpp game.cpp game_utils.cpp ui_utils.cpp
.\generala.exeLinux (Terminal)
g++ -o generala main.cpp game.cpp game_utils.cpp ui_utils.cpp
./generalaYou can also open the project using Code::Blocks (opening Generala.cbp) or Visual Studio Code (configuring tasks.json with the files listed above).
| English Interface | Spanish Interface |
![]() |
![]() |
| 🏆 In-Memory Ranking System | |
The system tracks high scores during the session, implementing sorting algorithms to rank players. |
|
| 🗳️ Screen results. | |
Game results. |
|
Guido Barbieri, Computer Programming Student UTN FRGP – Argentina
Special thanks to Tapio's rlutil API, it helped a lot during development.
This project will constantly evolve. Future updates will focus on code refactoring and optimizations, as well as improving some features like data persistance and fixing errors.




