Proof of concept
This commit is contained in:
55
proof_of_concept/credit_cardle.py
Normal file
55
proof_of_concept/credit_cardle.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import random
|
||||
|
||||
import credit_cards
|
||||
|
||||
GUESSES = 5
|
||||
|
||||
def main():
|
||||
card: credit_cards.CreditCard = random.choice(credit_cards.credit_cards)
|
||||
|
||||
correct_issuer = False
|
||||
correct_card = False
|
||||
|
||||
for guess in range(GUESSES):
|
||||
if guess == 0:
|
||||
print(f"Annual Fee: {card.annual_fee}")
|
||||
print(f"Signup Bonus: {card.signup_bonus}")
|
||||
print(f"Default Multiplier: {card.default_multiplier}")
|
||||
elif guess == 1:
|
||||
print(f"Points type: {card.points_type.value}")
|
||||
elif guess == 2:
|
||||
print(f"Category Multipliers: {[f'{multiplier[0].name}, {multiplier[1]}' for multiplier in card.category_multipliers]}")
|
||||
else:
|
||||
other_index = guess-3
|
||||
if other_index < len(card.other):
|
||||
print(f"Other: {card.other[other_index]}")
|
||||
|
||||
while True:
|
||||
if not correct_issuer:
|
||||
issuer_guess = input("Issuer Guess?")
|
||||
if issuer_guess in credit_cards.CardIssuer:
|
||||
issuer_guess = credit_cards.CardIssuer(issuer_guess)
|
||||
break
|
||||
|
||||
while True:
|
||||
card_name_guess = input("Card Name Guess?")
|
||||
if card_name_guess not in credit_cards.card_names_by_issuer[issuer_guess]:
|
||||
print(credit_cards.card_names_by_issuer[issuer_guess])
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
if issuer_guess == card.issuer and not correct_issuer:
|
||||
correct_issuer = True
|
||||
print("Correct issuer Guess!")
|
||||
|
||||
if card_name_guess == card.card_name:
|
||||
correct_card = True
|
||||
print("Correct card guess!")
|
||||
|
||||
if correct_issuer and correct_card:
|
||||
break
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user