From cf313e4e577a41e920558e98b66cff930900e555 Mon Sep 17 00:00:00 2001 From: mhouppin <45004383+mhouppin@users.noreply.github.com> Date: Sun, 30 May 2021 10:21:53 +0200 Subject: [PATCH] Use list comprehension to generate Syzygy candidate file names (#90) --- Client/Client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Client/Client.py b/Client/Client.py index e9e2e06..bba1ee0 100644 --- a/Client/Client.py +++ b/Client/Client.py @@ -179,13 +179,13 @@ def validate_syzygy_exists(): def tablebase_names(K=6): - letters = ['', 'Q', 'R', 'B', 'N', 'P']; candidates = [] + letters = ['', 'Q', 'R', 'B', 'N', 'P'] # Generate many potential K[] v K[], including all valid ones - for N in range(1, K - 1): - for lhs in combinations_with_replacement(letters, N): - for rhs in combinations_with_replacement(letters, K - N - 2): - candidates.append('K%svK%s' % (''.join(lhs), ''.join(rhs))) + candidates = ['K%svK%s' % (''.join(lhs), ''.join(rhs)) + for N in range(1, K - 1) + for lhs in combinations_with_replacement(letters, N) + for rhs in combinations_with_replacement(letters, K - N - 2)] # Syzygy does LHS having more pieces first, stronger pieces second def valid_filename(name):