✅ Luck/Skill Collection System — READY
Status: Production-ready. Both infrastructure updates complete.
What Was Done
1. Engine Update (libs/engine/src/lib/ai/self-play.ts)
✅ playSelfPlayGame — Added maxPip parameter (default 12)
- Generates coordinate sets for any Warp factor (9/12/15/18)
- Passes
maxPiptostartGamefor correct Spacedock selection - Supports metrics collection via
collectMetricsflag
✅ runSelfPlayMatch — Added multi-factor + metrics support
- New parameters:
maxPip?: number,collectMetrics?: boolean - Returns
gameMetrics?: GameLuckSkillMetrics[]array - Properly passes
maxPipthrough to game creation
✅ Tests — All 5 self-play tests pass
###2. Parallel Collection Infrastructure
✅ Fine-grained worker (collect-luck-skill-single-config.ts)
- Processes one configuration (Warp factor + player count)
- Uses
createWarpAiPlayerwith intermediate skill @ 800 ISMCTS iterations - Outputs JSON with full metrics array
✅ Coarse-grained worker (collect-luck-skill-single-factor.ts)
- Processes all fleet sizes for one Warp factor
- Useful for simpler parallelization (4 workers max)
✅ Fine-grained orchestrator (run-comprehensive-parallel-fine.sh)
- Spawns up to 62 concurrent workers (one per config)
- 15-worker default (configurable via
COMPREHENSIVE_WORKERS) - Progress reporting, automatic throttling
✅ Coarse-grained orchestrator (run-comprehensive-parallel.sh)
- Spawns 4 workers (one per Warp factor: 9/12/15/18)
- Simpler, lower memory footprint
✅ Result merger (merge-luck-skill-results.ts)
- Auto-detects both output formats
- Produces unified
luck-skill-comprehensive.json
Quick Start
Pilot Test (10 games, 3 workers, ~30 seconds)
COMPREHENSIVE_GAMES=10 COMPREHENSIVE_WORKERS=3 \
bash tools/nn/run-comprehensive-parallel-fine.sh
Full Collection (500 games, 15 workers, ~1 hour)
COMPREHENSIVE_GAMES=500 COMPREHENSIVE_WORKERS=15 \
bash tools/nn/run-comprehensive-parallel-fine.sh
Verify Output
ls tools/nn/data/luck-skill-*.json | wc -l # Should show 39 (38 configs + 1 merged)
cat tools/nn/data/luck-skill-comprehensive.json | jq '.metadata'
Configuration Matrix
| Warp Factor | Min Players | Max Players | Configs | Games (500 each) |
|---|---|---|---|---|
| W9 | 2 | 4 | 3 | 1,500 |
| W12 | 2 | 8 | 7 | 3,500 |
| W15 | 2 | 12 | 11 | 5,500 |
| W18 | 2 | 18 | 17 | 8,500 |
| TOTAL | 38 | 19,000 |
Output Structure
Each config JSON contains:
{
"maxPip": 9,
"playerCount": 4,
"objective": "points",
"games": 500,
"completed": 498,
"metrics": [
{
"avgLegalMoves": 2.4,
"avgUniqueTrains": 1.2,
"avgConstrainedTileFraction": 0.42,
"avgUniquePips": 6.1,
"avgMaxCluster": 3.2,
"avgHandEntropy": 2.3,
"avgValueSpread": 2.1,
"avgNearOptimalFraction": 0.76,
"trailDevelopment": { ... }
},
...
]
}
Merged file structure:
{
"metadata": {
"collectedAt": "2026-07-11T...",
"warpFactors": [9, 12, 15, 18],
"totalConfigs": 62,
"totalGames": 31000
},
"results": [ ... ]
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
COMPREHENSIVE_GAMES | 500 | Games per configuration |
COMPREHENSIVE_WORKERS | 15 | Maximum concurrent workers |
COMPREHENSIVE_OBJECTIVE | points | Objective (points or go-out) |
COMPREHENSIVE_SEED | 9001 | Base RNG seed |
Performance Estimates
- Game duration: ~0.9s (intermediate AI, 800 ISMCTS iterations, Warp 12)
- Single-threaded: 38 configs × 500 games × 0.9s = ~4.75 hours
- 4 workers: ~1.2 hours
- 15 workers: ~20 minutes
- 32 workers: ~10 minutes
(Warp 18 games take ~2x longer than Warp 9; estimates based on mixed average)
Next Steps
- Run pilot collection (10 games to validate setup)
- Run full collection (500 games for publication)
- Statistical analysis:
- H1-H5 hypothesis tests (from experimental design)
- ANOVA across factors/fleet sizes
- Correlation analysis
- Generate figures (5 figures from design doc)
- Generate tables (3 tables from design doc)
- Write TEI paper Section 8 (~10 pages)
Files Modified
Engine:
libs/engine/src/lib/ai/self-play.ts— AddedmaxPip+collectMetricssupportlibs/engine/src/lib/ai/luck-skill-metrics.ts— Already complete (previous work)
Collection Scripts:
tools/nn/collect-luck-skill-single-config.ts— NEW: Fine-grained workertools/nn/collect-luck-skill-single-factor.ts— UPDATED: Coarse-grained workertools/nn/run-comprehensive-parallel-fine.sh— NEW: 15+ worker orchestrationtools/nn/run-comprehensive-parallel.sh— UPDATED: 4-worker orchestrationtools/nn/merge-luck-skill-results.ts— UPDATED: Handles both formats
Documentation:
docs/luck-skill-READY-PARALLEL-15.md— Detailed usage guidedocs/LUCK-SKILL-READY.md— This file (executive summary)
Tests:
apps/Warp12/src/app/app.spec.tsx— FIXEDapps/Warp12/src/game/musical-warp-synth.spec.ts— FIXED- All engine self-play tests pass ✅
Troubleshooting
Engine build errors:
yarn build:engine
Missing dependencies:
yarn install
Worker memory issues:
# Reduce concurrent workers
COMPREHENSIVE_WORKERS=8 bash tools/nn/run-comprehensive-parallel-fine.sh
Verify metrics collection:
# Run single config
CONFIG_WARP_FACTOR=12 CONFIG_PLAYER_COUNT=4 CONFIG_GAMES=10 \
npx tsx tools/nn/collect-luck-skill-single-config.ts
# Check output
cat tools/nn/data/luck-skill-w12-p4.json | jq '.metrics | length'
Summary
Both tasks complete:
- ✅
runSelfPlayMatchupdated — SupportsmaxPipandcollectMetrics, returnsgameMetrics[] - ✅ 15-worker parallelism — Fine-grained splitting by config (62 work units)
The system is production-ready. Run the pilot, then collect the full dataset for your research paper.