Expand description
A generic command-line runner: give it any [turnbase::Game] and get a
headless CLI, bot self-play, and interactive play, with no per-game
plumbing.
Two tiers:
runneeds only aGamewhoseState/Action/Vieware serde-serializable. It providesnew/query/act(headless, file-backed via [turnbase_session::FileSession]),self-play(bots), and a textplay. Actions on the command line are JSON, so it works for any game.run_tui(thetuifeature, on by default) additionally requires [turnbase_simulator::PrintableGame] and swaps the textplayfor the retroglyph dashboard. Everything else is identical.
A game’s main is then one line, e.g. turnbase_cli::run(TicTacToe) or
turnbase_cli::run_tui(Coup::new(4)).
Structs§
- Play
Args - Arguments for the interactive
playcommand, exposed so a game that passes its ownplayhandler torun_with_playcan read them.
Functions§
- run
- Runs the text/headless CLI for
game:new,query,act,self-play, and a textplay. Works for any game whose types are serde-serializable. - run_tui
- Like
run, butplayopens the retroglyph dashboard instead of the text stepper. Requires the game to implement [PrintableGame]. - run_
with_ play - Like
run, but the game supplies its own interactiveplayhandler (a bespoke UI, say) rather than the built-in text stepper.