How aneprados/examen_extraordinaria works
Project type and purpose
• This is a standalone, command-line planetary system simulator written in Python.
• It models bodies in 3D space, computes gravitational interactions, advances simulation steps, and persists state (JSON/CSV).
File structure
• Top-level Python modules:
• Domain/model: Clase_vector_3D.py, Cuerpos_celestes.py
• Core logic: Simulador.py
• CLI interface: Lanzador.py, main.py
• Alternate implementation: nose.py (alternative Vector3D)
• Tests: Pruebas_unitarias.py, Pruebas_cuerpo.py, Pruebas_del_simulador.py
• No web frontend or separate “backend” service—everything runs in one process.
• Persistence handled inside Simulador (JSON/CSV).
README for additional insights
• Dependencies: Python ≥3.10, pytest
• Simulation features, persistence formats, interactive menu
• No external services or databases
Main components & their relationships
a. Domain layer
• Vector3D class (vector operations)
• CuerpoCeleste class (mass, position, velocity, energy, apply forces)
b. Simulation engine
• Simulador class: orchestrates N-body computation, time steps, uses Domain classes, handles persistence
c. Presentation/CLI
• Lanzador: command parsing, invokes Simulador methods
• main: entry point, initializes Simulador & Lanzador, starts interactive loop
d. Persistence
• JSON/CSV readers & writers embedded in Simulador
e. Tests
• Three test modules depending on each core class
Architectural patterns & design principles
• Layered architecture (Presentation → Application/Engine → Domain → Infrastructure)
• Single responsibility: each class has a focused role (vector math, celestial body, engine, CLI)
• Dependency direction: upper layers (CLI/tests) depend on lower layers (engine, domain)
Detail without over-splitting
• Both the computational flow (Vector → Body → Simulator → CLI) and data persistence paths
• Test suites hooking into each component