Skip to content

Commit 1a60300

Browse files
authored
Slightly refine parameter validation in lcp_solve
1 parent ce5114c commit 1a60300

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/pygambit/nash.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,22 +206,18 @@ def lcp_solve(
206206
If stop_after or max_depth are supplied for use on the tree representation.
207207
"""
208208
if game.is_tree and not use_strategic:
209-
if stop_after:
209+
if stop_after is not None:
210210
raise ValueError(
211211
"lcp_solve(): stop_after can only be used on the strategic representation"
212212
)
213-
if max_depth:
213+
if max_depth is not None:
214214
raise ValueError(
215215
"lcp_solve(): max_depth can only be used on the strategic representation"
216216
)
217-
if stop_after is None:
218-
stop_after = 0
219-
elif stop_after < 0:
217+
if stop_after is not None and stop_after < 0:
220218
raise ValueError(
221219
f"lcp_solve(): stop_after argument must be a non-negative number; got {stop_after}"
222220
)
223-
if max_depth is None:
224-
max_depth = 0
225221
if not game.is_tree or use_strategic:
226222
if rational:
227223
equilibria = libgbt._lcp_strategy_solve_rational(game, stop_after or 0, max_depth or 0)

0 commit comments

Comments
 (0)