Commit 2622b6dc authored by Stefan Behnel's avatar Stefan Behnel

simplify nqueens benchmark

parent 9d77b151
...@@ -58,8 +58,8 @@ def n_queens(queen_count): ...@@ -58,8 +58,8 @@ def n_queens(queen_count):
""" """
cols = range(queen_count) cols = range(queen_count)
for vec in permutations(cols): for vec in permutations(cols):
if (queen_count == len(set([vec[i]+i for i in cols])) if (queen_count == len({ vec[i]+i for i in cols })
== len(set([vec[i]-i for i in cols]))): == len({ vec[i]-i for i in cols })):
yield vec yield vec
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment