Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aad5a8a

Browse files
committed
Improved test of and_or_search
1 parent e7479db commit aad5a8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def run_plan(state, problem, plan):
3939
return True
4040
if len(plan) is not 2:
4141
return False
42-
next_state = choice(problem.result(state, plan[0]))
43-
return run_plan(next_state, problem, plan[1][next_state])
42+
predicate = lambda x : run_plan(x, problem, plan[1][x])
43+
return every(predicate, problem.result(state, plan[0]))
4444
plan = and_or_graph_search(vacumm_world)
4545
assert run_plan('State_1', vacumm_world, plan)
4646

0 commit comments

Comments
 (0)