generate_draft_pool.py prints output

This commit is contained in:
henriquenakashima 2021-02-28 12:38:42 -05:00
parent 723fb00b3a
commit 65ac7239ca

View file

@ -1,6 +1,6 @@
# Generate a draft pool for dr4ft.info
import random
import hashlib
import cube_json
import cube_pool
@ -25,8 +25,12 @@ def main():
pools['occasional'].wide_sample(CARDS_FROM_OCCASIONAL))
main_pool_names = [card.name for card in main_pool]
with open(OUTPUT_FILENAME, 'w') as f:
f.write('\n'.join(main_pool_names))
with open(OUTPUT_FILENAME, 'wb') as f:
full_pool_contents = '\n'.join(main_pool_names).encode('utf-8')
f.write(full_pool_contents)
print(f'Wrote {len(main_pool_names)} cards to {OUTPUT_FILENAME}')
hash = hashlib.sha1(full_pool_contents).hexdigest()
print(f'Hash is {hash}')
if __name__ == '__main__':