game: rewrite, document, and rename solve_reachability_game

* spot/twaalgos/game.hh, spot/twaalgos/game.cc: Rename
solve_reachability_game() as solve_safety_game(), rewrite it (the old
implementation incorrectly marked dead states as winning for their
owner).
* tests/python/paritygame.ipynb: Rename as...
* tests/python/games.ipynb: ... this, and illustrate
solve_safety_game().
* tests/Makefile.am, NEWS, doc/org/tut.org: Adjust.
* tests/python/except.py: Add more tests.
This commit is contained in:
Alexandre Duret-Lutz 2020-12-09 17:18:20 +01:00
parent 05449a42d3
commit 9a17f5676c
7 changed files with 784 additions and 87 deletions

View file

@ -196,24 +196,39 @@ assert spot.is_deterministic(a2)
try:
spot.product_xor(a1, a2)
except RuntimeError as e:
assert "product_xor() only works with deterministic automata"
assert "product_xor() only works with deterministic automata" in str(e)
else:
report_missing_exception()
try:
spot.product_xor(a2, a1)
except RuntimeError as e:
assert "product_xor() only works with deterministic automata"
assert "product_xor() only works with deterministic automata" in str(e)
else:
report_missing_exception()
try:
spot.product_xnor(a1, a2)
except RuntimeError as e:
assert "product_xnor() only works with deterministic automata"
assert "product_xnor() only works with deterministic automata" in str(e)
else:
report_missing_exception()
try:
spot.product_xnor(a2, a1)
except RuntimeError as e:
assert "product_xnor() only works with deterministic automata"
assert "product_xnor() only works with deterministic automata" in str(e)
else:
report_missing_exception()
try:
spot.solve_safety_game(a1)
except RuntimeError as e:
assert "solve_safety_game(): arena should have true acceptance" in str(e)
else:
report_missing_exception()
try:
spot.solve_parity_game(a1)
except RuntimeError as e:
assert "solve_parity_game(): arena must have max-odd acceptance condition" \
in str(e)
else:
report_missing_exception()