|
6 | 6 | import sys |
7 | 7 | from pathlib import Path |
8 | 8 |
|
9 | | -from .benchmark import BenchmarkAnalyzer |
10 | 9 | from .bot import LLMBot, setup_logging |
11 | 10 | from .config import Config |
12 | 11 |
|
13 | 12 |
|
14 | 13 | def main() -> None: |
15 | 14 | """Main CLI entry point for balatrollm. |
16 | 15 |
|
17 | | - Parses command line arguments and executes the appropriate command. |
18 | | - Supports both the main balatrollm command and benchmark subcommand. |
| 16 | + Parses command line arguments and executes the game. |
19 | 17 | """ |
20 | 18 | parser = _create_argument_parser() |
21 | 19 | args = parser.parse_args() |
22 | 20 |
|
23 | 21 | setup_logging() |
24 | | - |
25 | | - match args.command: |
26 | | - case "benchmark": |
27 | | - cmd_benchmark(args) |
28 | | - case None: |
29 | | - asyncio.run(cmd_balatrollm(args)) |
30 | | - case _: |
31 | | - print(f"Unknown command: {args.command}") |
32 | | - sys.exit(1) |
| 22 | + asyncio.run(cmd_balatrollm(args)) |
33 | 23 |
|
34 | 24 |
|
35 | 25 | async def cmd_balatrollm(args) -> None: |
@@ -178,52 +168,19 @@ async def _port_worker( |
178 | 168 | await asyncio.sleep(1) |
179 | 169 |
|
180 | 170 |
|
181 | | -def cmd_benchmark(args) -> None: |
182 | | - """Run the benchmark command. |
183 | | -
|
184 | | - Analyzes run data and generates comprehensive leaderboards. |
185 | | -
|
186 | | - Args: |
187 | | - args: Parsed command line arguments containing runs_dir, output_dir, and avif flag. |
188 | | -
|
189 | | - Raises: |
190 | | - FileNotFoundError: If the runs directory doesn't exist. |
191 | | - Exception: If benchmark analysis fails for any other reason. |
192 | | - """ |
193 | | - try: |
194 | | - analyzer = BenchmarkAnalyzer(args.runs_dir, args.output_dir) |
195 | | - analyzer.analyze_all_runs() |
196 | | - |
197 | | - # Convert PNGs to AVIF if requested |
198 | | - if args.avif: |
199 | | - print("Converting PNG screenshots to AVIF format...") |
200 | | - analyzer.convert_pngs_to_avif(args.output_dir) |
201 | | - except FileNotFoundError as e: |
202 | | - print(f"Error: {e}") |
203 | | - sys.exit(1) |
204 | | - except Exception as e: |
205 | | - print(f"Benchmark analysis failed: {e}") |
206 | | - sys.exit(1) |
207 | | - |
208 | | - |
209 | 171 | def _create_argument_parser() -> argparse.ArgumentParser: |
210 | 172 | """Create and configure argument parser. |
211 | 173 |
|
212 | | - Sets up command line argument parsing for both the main balatrollm |
213 | | - command and the benchmark subcommand. |
| 174 | + Sets up command line argument parsing for the balatrollm command. |
214 | 175 |
|
215 | 176 | Returns: |
216 | | - Configured ArgumentParser instance with all commands and options. |
| 177 | + Configured ArgumentParser instance with all options. |
217 | 178 | """ |
218 | 179 | parser = argparse.ArgumentParser( |
219 | 180 | description="LLM-powered Balatro bot", |
220 | 181 | formatter_class=argparse.RawDescriptionHelpFormatter, |
221 | 182 | ) |
222 | 183 |
|
223 | | - # Add subcommands |
224 | | - subparsers = parser.add_subparsers(dest="command", help="Available commands") |
225 | | - |
226 | | - # Default command (play game) - no subcommand needed, just use main parser |
227 | 184 | parser.add_argument( |
228 | 185 | "-m", |
229 | 186 | "--model", |
@@ -300,28 +257,4 @@ def _create_argument_parser() -> argparse.ArgumentParser: |
300 | 257 | help="Use BalatroBot's default storage paths for screenshots and game logs", |
301 | 258 | ) |
302 | 259 |
|
303 | | - # Benchmark subcommand |
304 | | - benchmark_parser = subparsers.add_parser( |
305 | | - "benchmark", |
306 | | - help="Analyze runs and generate leaderboards", |
307 | | - description="Analyze BalatroLLM runs and generate comprehensive leaderboards", |
308 | | - ) |
309 | | - benchmark_parser.add_argument( |
310 | | - "--runs-dir", |
311 | | - type=lambda p: Path(p).resolve(), |
312 | | - default=Path("runs").resolve(), |
313 | | - help="Directory containing run data (default: runs)", |
314 | | - ) |
315 | | - benchmark_parser.add_argument( |
316 | | - "--output-dir", |
317 | | - type=Path, |
318 | | - default=Path("benchmarks"), |
319 | | - help="Output directory for benchmark results (default: benchmarks)", |
320 | | - ) |
321 | | - benchmark_parser.add_argument( |
322 | | - "--avif", |
323 | | - action="store_true", |
324 | | - help="Convert PNG screenshots to AVIF format after analysis", |
325 | | - ) |
326 | | - |
327 | 260 | return parser |
0 commit comments