How angle-brackets/ttrsolver works
TTRSolver is an external battle-advice tool: it reads visible game information, forms a battle snapshot, evaluates moves with a rules simulator and several AI engines, then presents recommendations. The README documents the ingestion sources and three front ends; the source index supports the core solver dependencies and the visualizer bridge. Some live-source wiring is documented but not visible in sampled code, so those edges cite the README.
Main entry points: state.py Battle state · worker.py Live advice worker · simulator.py Battle simulator · expectimax.py Expectimax search
Components 20
Game ingestion
- Screen capture and OCR
solver/live/vision.py - TTR Local API
solver/live/ttr_local.py - Client log reader
solver/live/ttr_log.py - Discord relay
solver/live/discord_relay.py - Realms stream
solver/live/realms.py
Battle model
- Battle state
solver/state.py - Game rules and data
solver/data/gags.py - Combat mechanics
solver/mechanics.py - Battle simulator
solver/simulator.py - Outcome distributions
solver/outcomes.py
Advice engines
- Expectimax search
solver/search/expectimax.py - PPO environment
solver/rl/env.py - Hybrid policy search
solver/search/hybrid.py - Full-fight playout
solver/search/playout.py
Live advisor
- Live advice worker
solver/live/worker.py
User interfaces
- Live overlay
solver/live/overlay.py - Browser visualizer
visualizer/bridge.py - Terminal advisor
solver/live/advise.py
Other components
- Player
- Toontown game
Connections 33
- Toontown game → Screen capture and OCR: shows battle on
README.md - Toontown game → TTR Local API: publishes opt-in data
README.md - Toontown game → Client log reader: writes log
README.md - Toontown game → Discord relay: publishes presence
README.md - Toontown game → Realms stream: publishes stream
README.md - Screen capture and OCR → Battle state: reads visible state
README.md - TTR Local API → Battle state: supplies toon data
README.md - Client log reader → Battle state: detects boss room
README.md - Discord relay → Battle state: supplies floor data
README.md - Realms stream → Battle state: supplies combat state
README.md - Game rules and data → Combat mechanics: defines gag rules
solver/mechanics.py - Battle state → Battle simulator: transitions state
solver/simulator.py - Combat mechanics → Battle simulator: resolves actions
solver/simulator.py - Battle simulator → Outcome distributions: supports exact distributions
solver/outcomes.py - Battle state → Expectimax search: supplies search state
solver/search/expectimax.py - Outcome distributions → Expectimax search: branches on outcomes
solver/search/expectimax.py - Battle simulator → PPO environment: steps environment
solver/rl/env.py - Battle state → PPO environment: encodes observations
solver/rl/env.py - PPO environment → Hybrid policy search: proposes actions
solver/search/hybrid.py - Battle state → Hybrid policy search: ranks candidate plans
solver/search/hybrid.py - Hybrid policy search → Full-fight playout: seeds candidates
README.md - Battle state → Full-fight playout: plays fight forward
solver/search/playout.py - Battle simulator → Full-fight playout: simulates rounds
solver/search/playout.py - Battle state → Live advice worker: provides live snapshot
solver/live/worker.py - Live advice worker → Hybrid policy search: requests advice
solver/live/worker.py - Live advice worker → Full-fight playout: requests evaluation
solver/live/worker.py - Live advice worker → Expectimax search: requests search
- Live advice worker → Live overlay: updates recommendations
README.md - Player → Live overlay: views suggestions
README.md - Player → Browser visualizer: explores scenarios
README.md - Expectimax search → Browser visualizer: provides search tree
README.md - Player → Terminal advisor: requests advice
README.md - Expectimax search → Terminal advisor: returns suggestions
README.md