Skip to content

Commit a6ab187

Browse files
committed
dpll: python check on array length
1 parent 809ec7c commit a6ab187

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

other/davisb_putnamb_logemannb_loveland.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,9 @@ def dpll_algorithm(
319319
except RecursionError:
320320
print("raises a RecursionError and is")
321321
return None, {}
322-
P = None
323-
if len(pure_symbols) > 0:
324-
P, value = pure_symbols[0], assignment[pure_symbols[0]]
325322

326-
if P:
323+
if pure_symbols:
324+
P, value = pure_symbols[0], assignment[pure_symbols[0]]
327325
tmp_model = model
328326
tmp_model[P] = value
329327
tmp_symbols = [i for i in symbols]
@@ -333,10 +331,8 @@ def dpll_algorithm(
333331

334332
# 4. Unit symbols
335333
unit_symbols, assignment = find_unit_clauses(clauses, model)
336-
P = None
337-
if len(unit_symbols) > 0:
334+
if unit_symbols:
338335
P, value = unit_symbols[0], assignment[unit_symbols[0]]
339-
if P:
340336
tmp_model = model
341337
tmp_model[P] = value
342338
tmp_symbols = [i for i in symbols]

0 commit comments

Comments
 (0)