Add generate_tringleton.py
This commit is contained in:
parent
298f37e045
commit
b2b7dc132f
2 changed files with 32 additions and 0 deletions
31
generate_tringleton.py
Normal file
31
generate_tringleton.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import json
|
||||
import random
|
||||
|
||||
from typing import Dict, List
|
||||
|
||||
|
||||
CardFace = Dict
|
||||
|
||||
|
||||
def is_eligible(card: List[CardFace]):
|
||||
card_face = card[0]
|
||||
return card_face['type'] != 'Dungeon'
|
||||
|
||||
|
||||
def main():
|
||||
with open('ModernAtomic.json', encoding='utf8') as f_oracle_cards:
|
||||
d: Dict = json.load(f_oracle_cards)
|
||||
print (d['meta'])
|
||||
all_cards: Dict = d['data']
|
||||
|
||||
all_eligible_card_names: List[str] = [name for name, card in all_cards.items() if is_eligible(card)]
|
||||
random_unique_120: List[str] = random.sample(sorted(all_eligible_card_names), 120)
|
||||
with open('random_tringleton.txt', 'w+', encoding='utf8') as output:
|
||||
for card in random_unique_120:
|
||||
for _ in range(3):
|
||||
output.write(card + '\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue