How tomas-dorado/tema-3 works
Project Type and Purpose
• This is an educational CLI/Pygame‑based Python application consisting of four independent “exercises” (Ejercicio_1…4), each demonstrating different algorithmic concepts.
• A root menu (menu.py / main.py) lets the user pick and run any exercise.
File Structure
• Top‑level:
• menu.py / main.py: dispatch layer
• requeriment.txt: dependencies
• README.md
• Subdirectories Ejercicio_1…Ejercicio_4, each with:
• main.py (entry point for that exercise)
• Domain modules (classes or functions) implementing the core logic
• A launcher (Lanzador.py) in Ejercicio_3 & 4
• No external services or databases; purely in‑process modules.
README for Insights
• Each exercise is described with its main files and responsibilities.
• Dependencies: only pygame (for Ejercicio_1) and standard Python libs.
Main Components & Their Interactions
a. Root Layer:
• User (CLI) → menu.py / main.py
• menu.py presents options → invokes the chosen exercise’s entry point
b. Exercise 1 – “Torres de Hanói”:
• main.py
• HanoiGame (Game.py) – orchestrates solution
• Torre (Torre.py) – model for a peg
• Disco (Nodo.py) – represents a disk
• pygame UI renderer
c. Exercise 2 – “Determinante de Matrices”:
• main.py
• Iterativo.py – iterative determinant function
• Recursivo.py – recursive determinant function
d. Exercise 3 – “Gestión de Naves”:
• main.py
• Lanzador.py – parses input, calls filter/sort routines
• (potentially data model module if added)
e. Exercise 4 – “Polinomios Mágicos”:
• main.py
• Polinomio.py – PolinomioMagico class with arithmetic methods
• Lanzador.py – CLI wrapper for operations
Architectural Patterns & Principles
• Modular packaging: each exercise is a self‑contained package.
• Clear separation of concerns: presentation/launcher vs. domain logic.
• Single‐responsibility per module/class.
Final Checklist
• Clear labels on all four exercise components and the root menu.
• User → Root Menu → Exercise main → Domain modules.
• UI/launcher modules
• Algorithm/domain logic modules
• Optional: note dependencies (pygame for E1).