Release v0.3.0: CSV output, wishlist commands, improved error handling

- Replace stdout output with structured CSV file generation
- Add wishlist, all commands with --min-count and --max-wishlist flags
- Introduce CarCounts struct for shared analysis computation
- Improve error handling: return Result instead of unwrap/panic
- Add prize field to BestCarRecord
- Remove TODO.md
This commit is contained in:
Jan-Peter von Hunnius 2026-05-07 20:13:30 +02:00
parent 08c96d9981
commit 9d57b18a4e
8 changed files with 697 additions and 594 deletions

143
README.md
View file

@ -1,12 +1,12 @@
# Top Drives Records Analyzer
A comprehensive Rust-based tool for analyzing car performance data in the Top Drives racing game. This tool fetches track times from a community-maintained repository and provides detailed analysis including best cars, missing cars, and optimization recommendations.
A comprehensive Rust-based tool for analyzing car performance data in the Top Drives racing game. This tool fetches track times from a community-maintained repository and provides detailed analysis including best cars, trash identification, and wishlist optimization.
## 🚀 Features
- **Best Car Analysis**: Find the best performing cars across all tracks and conditions
- **Missing Cars Detection**: Identify cars missing from your collection that would improve performance
- **Collection Optimization**: Identify cars that can be safely removed from your collection
- **Wishlist Optimization**: Identify cars to add to or remove from your wishlist
- **Collection Cleanup**: Identify cars that can be safely removed from your collection
- **Track-Specific Analysis**: Get detailed performance data for specific tracks and conditions
- **RQ-Based Filtering**: Filter results by car rarity (RQ) levels
- **Multiple Surface Types**: Support for Dry, Wet, Dirt, Snow, and other track conditions
@ -55,14 +55,14 @@ A comprehensive Rust-based tool for analyzing car performance data in the Top Dr
cargo run --bin records -- fetch
```
2. **Basic Analysis**: Find the best cars in your collection
2. **Full Analysis**: Generate all output files in a single pass
```bash
cargo run --bin records -- best
cargo run --bin records -- all
```
3. **Find Missing Cars**: Discover cars that would improve your performance
3. **Best Cars**: Find the best cars across all tracks
```bash
cargo run --bin records -- missing
cargo run --bin records -- best
```
4. **Collection Cleanup**: Identify cars safe to remove
@ -70,6 +70,11 @@ A comprehensive Rust-based tool for analyzing car performance data in the Top Dr
cargo run --bin records -- trash
```
5. **Wishlist Management**: Optimize your wishlist
```bash
cargo run --bin records -- wishlist
```
## 📖 Usage Guide
### Basic Commands
@ -84,33 +89,79 @@ Downloads the latest car database and track information from the community repos
```bash
cargo run --bin records -- best
```
Shows all cars in your collection ranked by their performance across tracks.
Generates `best.csv` (all cars best on at least one track) and `very_best.csv` (cars best on ≥10 tracks). Both files are sorted by RQ.
**Sample Output:**
**Output Files:**
```
RQ,Brand,Model,Year,Count
85,McLaren,F1,1993,15
82,Ferrari,250 GTO,1962,12
80,Lamborghini,Countach,1974,8
best.csv — All cars best on at least one track
very_best.csv — Cars best on ≥10 tracks (default)
```
#### Missing Cars Analysis
Use `--min-count N` to change the threshold for `very_best.csv`:
```bash
cargo run --bin records -- missing
cargo run --bin records -- best --min-count 5
```
Shows the best cars that you don't own, helping prioritize acquisitions.
#### Collection Optimization
#### Trash Analysis
```bash
cargo run --bin records -- trash
```
Identifies cars in your collection that aren't among the best performers and could be removed.
Generates `trash.csv` — owned cars that are not best on any track, have RQ < 80, and are not prize cars. Sorted by RQ.
**Output File:**
```
trash.csv — Owned cars safe to remove
```
#### Wishlist Management
```bash
cargo run --bin records -- wishlist
```
Generates `wishlist.csv` (ideal wishlist: very_best unowned cars, capped at 300), `add.csv` (cars that should be on your wishlist but aren't), and `remove.csv` (cars on your wishlist that shouldn't be). All sorted by RQ.
**Output Files:**
```
wishlist.csv — Ideal wishlist (very_best unowned, capped)
add.csv — Cars to add to wishlist
remove.csv — Cars to remove from wishlist
```
Use `--min-count N` to change the threshold for very_best cars (default 10):
```bash
cargo run --bin records -- wishlist --min-count 5
```
Use `--max-wishlist M` to change the wishlist cap (default 300):
```bash
cargo run --bin records -- wishlist --max-wishlist 500
```
#### Full Analysis
```bash
cargo run --bin records -- all
```
Generates all 6 CSV files in a single parse pass. Equivalent to running `best`, `trash`, and `wishlist` together, but more efficient.
**Output Files:**
```
best.csv — All cars best on at least one track
very_best.csv — Cars best on ≥10 tracks
trash.csv — Owned cars safe to remove
wishlist.csv — Ideal wishlist (very_best unowned, capped)
add.csv — Cars to add to wishlist
remove.csv — Cars to remove from wishlist
```
Supports both `--min-count N` (default 10) and `--max-wishlist M` (default 300):
```bash
cargo run --bin records -- all --min-count 5 --max-wishlist 500
```
#### Detailed Performance Data
```bash
cargo run --bin records -- details
```
Shows comprehensive timing data for all tracks and conditions.
Generates `details.csv` with comprehensive timing data for all tracks and conditions.
**Sample Output:**
```
@ -123,12 +174,12 @@ RQ,TrackID,Condition,CarRQ,Brand,Model,Year,Config,Time
```bash
cargo run --bin records -- track "Laguna Seca" "Dry" "85"
```
Finds the best car for a specific track, condition, and RQ combination.
Prints the best car for a specific track, condition, and RQ combination to stdout.
### Advanced Usage
#### Multiple RQ Analysis
The tool supports analyzing performance across different RQ ranges. Use the `missing` and `best` commands to see how cars perform at various rarity levels.
The tool supports analyzing performance across different RQ ranges. Use the `best` and `wishlist` commands to see how cars perform at various rarity levels.
#### Track Conditions
The analyzer supports multiple track conditions:
@ -143,37 +194,49 @@ The analyzer supports multiple track conditions:
| Command | Description | Arguments |
|---------|-------------|-----------|
| `fetch` | Download latest car and track data | None |
| `best` | Show best performing cars in collection | None |
| `missing` | Show best cars not in collection | None |
| `trash` | Show cars safe to remove from collection | None |
| `details` | Show detailed timing data for all tracks | None |
| `track` | Show best car for specific track | `<track_name> <condition> <rq>` |
| `best` | Generate `best.csv` and `very_best.csv` | `[--min-count N]` |
| `trash` | Generate `trash.csv` (owned cars safe to remove) | None |
| `wishlist` | Generate `wishlist.csv`, `add.csv`, `remove.csv` | `[--min-count N] [--max-wishlist M]` |
| `all` | Generate all 6 CSV files in a single pass | `[--min-count N] [--max-wishlist M]` |
| `details` | Print detailed timing data for all tracks (stdout) | None |
| `track` | Print best car for specific track (stdout) | `<track_name> <condition> <rq>` |
### Flags
| Flag | Default | Description |
|------|---------|-------------|
| `--min-count N` | `10` | Minimum number of tracks a car must be best on to qualify as "very best" |
| `--max-wishlist M` | `300` | Maximum number of cars on the ideal wishlist |
## 📅 Daily Workflow
The typical daily workflow uses `full_script` which runs `fetch` followed by all analysis commands in sequence:
The typical daily workflow uses the `all` command, which runs all analysis in a single efficient parse pass:
```bash
cargo run --bin records -- full_script
cargo run --bin records -- fetch
cargo run --bin records -- all
```
This generates the following output files:
Or combine them:
```bash
cargo run --bin records -- fetch && cargo run --bin records -- all
```
| File | Description |
|------|-------------|
| `best.csv` | Ranked list of best cars — used to evaluate if a car is worth keeping |
| `details.csv` | Detailed timing data for all tracks/conditions — used to find the best config for a car |
| `add.csv` | Cars to add to wishlist — missing cars not yet wishlisted, prefixed with `+` |
| `remove.csv` | Cars to remove from wishlist — stale wishlist entries, prefixed with `-` |
| `trash.csv` | Owned cars that can be safely removed |
| `sorted.csv` | Best cars sorted by count (descending) |
| `very_best.csv` | Best cars with count ≥ 10 |
| `wishlist.csv` | Missing cars already on wishlist |
This generates the following output files (all sorted by car RQ):
| File | Format | Description |
|------|--------|-------------|
| `best.csv` | `RQ,Brand,Model,Year,Count` | All cars best on at least one track |
| `very_best.csv` | `RQ,Brand,Model,Year,Count` | Cars best on ≥ min_count tracks |
| `trash.csv` | `RQ,Brand,Model,Year` | Owned cars not best on any track (RQ<80, not prize) |
| `wishlist.csv` | `RQ,Brand,Model,Year,Count` | Ideal wishlist (very_best unowned, capped) |
| `add.csv` | `RQ,Brand,Model,Year,Count` | Cars to add to wishlist |
| `remove.csv` | `RQ,Brand,Model,Year,Count` | Cars to remove from wishlist |
### Workflow Steps
1. **Fetch** fresh data from the community repository
2. **Analyze** your collection against the latest timing data
2. **Analyze** your collection with `all` to generate all CSV files
3. **Review** `best.csv` to see how your cars rank
4. **Check** `add.csv` for cars worth adding to your wishlist
5. **Clean up** `remove.csv` entries from your wishlist