game: teach solve_game to use solve_safety_game

* spot/twaalgos/game.cc, spot/twaalgos/game.hh: Here.
* doc/org/tut40.org: Adjust example.
This commit is contained in:
Alexandre Duret-Lutz 2021-10-07 09:25:01 +02:00
parent bdd20bd1a1
commit 7bc2c31043
3 changed files with 27 additions and 12 deletions

View file

@ -774,9 +774,12 @@ namespace spot
return pg.solve(arena);
}
bool solve_game(twa_graph_ptr arena)
bool solve_game(const twa_graph_ptr& arena)
{
bool dummy1, dummy2;
auto& acc = arena->acc();
if (acc.is_t())
return solve_safety_game(arena);
if (!arena->acc().is_parity(dummy1, dummy2, true))
throw std::runtime_error
("solve_game(): unsupported acceptance condition.");
@ -1090,7 +1093,7 @@ namespace spot
}
bool solve_safety_game(twa_graph_ptr game)
bool solve_safety_game(const twa_graph_ptr& game)
{
if (!game->acc().is_t())
throw std::runtime_error

View file

@ -93,14 +93,22 @@ namespace spot
/// Returns the player winning in the initial state, and sets
/// the state-winner and strategy named properties.
SPOT_API
bool solve_safety_game(twa_graph_ptr game);
bool solve_safety_game(const twa_graph_ptr& game);
/// \ingroup games
/// \brief Generic interface for game solving
///
/// See solve_game(arena, gi)
/// Dispatch to solve_safety_game() if the acceptance condition is
/// t, or to solve_parity_game() if it is a parity acceptance. Note that
/// parity acceptance include Büchi, co-Büchi, Rabin 1, and Streett 1.
///
/// Currently unable to solve game with other acceptance conditions
/// that are not parity.
///
/// Return the winning player for the initial state, and sets
/// the state-winner and strategy named properties.
SPOT_API bool
solve_game(twa_graph_ptr arena);
solve_game(const twa_graph_ptr& arena);
/// \ingroup games