Some checks failed
Build Simulation and Test / Run All Tests (push) Failing after 8m17s
Major rewrite.
66 lines
1.7 KiB
Python
66 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Interactive simulation entry point - runs simulation with UI."""
|
|
|
|
import sys
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
# Add project root to path
|
|
project_root = Path(__file__).parent.parent
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
from config import ConfigLoader, InteractiveConfig
|
|
from core.simulation_engine import SimulationEngine
|
|
|
|
|
|
def main():
|
|
"""Main entry point for interactive simulation."""
|
|
parser = argparse.ArgumentParser(description="Run interactive simulation with UI")
|
|
parser.add_argument(
|
|
"--config", "-c",
|
|
type=str,
|
|
help="Path to configuration file (JSON/YAML)",
|
|
default=None
|
|
)
|
|
parser.add_argument(
|
|
"--create-sample-configs",
|
|
action="store_true",
|
|
help="Create sample configuration files and exit"
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
# Create sample configs if requested
|
|
if args.create_sample_configs:
|
|
ConfigLoader.create_sample_configs()
|
|
return
|
|
|
|
# Load configuration
|
|
try:
|
|
if args.config:
|
|
config = ConfigLoader.load_interactive_config(args.config)
|
|
else:
|
|
config = ConfigLoader.get_default_interactive_config()
|
|
|
|
except Exception as e:
|
|
print(f"Error loading configuration: {e}")
|
|
sys.exit(1)
|
|
|
|
# Run simulation
|
|
try:
|
|
print("Starting interactive simulation...")
|
|
engine = SimulationEngine()
|
|
engine.run()
|
|
|
|
except KeyboardInterrupt:
|
|
print("\nSimulation interrupted by user")
|
|
sys.exit(0)
|
|
except Exception as e:
|
|
print(f"Simulation error: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |