Use list comprehension to generate Syzygy candidate file names (#90)

This commit is contained in:
mhouppin authored and GitHub committed 2021-05-30 04:21:53 -04:00
1 parent fa1f189cac
commit cf313e4e57
1 file changed
+5 -5
+5 -5
View File
@@ -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):