Main function to run round-to-round recovery analysis.
()
| 320 | |
| 321 | |
| 322 | def main(): |
| 323 | """Main function to run round-to-round recovery analysis.""" |
| 324 | parser = argparse.ArgumentParser(description="Analyze next-round win rates after losses by loss margin") |
| 325 | parser.add_argument( |
| 326 | "-d", "--log_dir", help="Path to directory containing tournament logs", type=Path, default="logs/" |
| 327 | ) |
| 328 | parser.add_argument("--output", "-o", default=OUTPUT_FILE, help="Output path for the visualization") |
| 329 | |
| 330 | args = parser.parse_args() |
| 331 | |
| 332 | # Validate input directory |
| 333 | if not args.log_dir.is_dir(): |
| 334 | print(f"Error: Directory '{args.log_dir}' does not exist") |
| 335 | return |
| 336 | |
| 337 | print(f"Analyzing round-to-round recovery patterns in: {args.log_dir}") |
| 338 | |
| 339 | # Analyze tournaments for recovery patterns |
| 340 | success_rates = analyze_tournament_directory(args.log_dir) |
| 341 | |
| 342 | if not success_rates: |
| 343 | print("No recovery data found. Ensure the directory contains PvP tournament metadata files.") |
| 344 | return |
| 345 | |
| 346 | # Create visualization |
| 347 | create_comeback_visualization(success_rates, args.output) |
| 348 | |
| 349 | |
| 350 | if __name__ == "__main__": |
no test coverage detected