From bffc50aef04010f557c08461c56344e4468b4830 Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Sat, 24 Jan 2026 21:56:11 -0800 Subject: [PATCH] Proof of concept --- .gitignore | 1 + proof_of_concept/credit_cardle.py | 55 ++++++++++++++++++++ proof_of_concept/credit_cards.py | 84 +++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 .gitignore create mode 100644 proof_of_concept/credit_cardle.py create mode 100644 proof_of_concept/credit_cards.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba0430d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ \ No newline at end of file diff --git a/proof_of_concept/credit_cardle.py b/proof_of_concept/credit_cardle.py new file mode 100644 index 0000000..ab96641 --- /dev/null +++ b/proof_of_concept/credit_cardle.py @@ -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() \ No newline at end of file diff --git a/proof_of_concept/credit_cards.py b/proof_of_concept/credit_cards.py new file mode 100644 index 0000000..8610529 --- /dev/null +++ b/proof_of_concept/credit_cards.py @@ -0,0 +1,84 @@ +from dataclasses import dataclass +from typing import NamedTuple, Tuple + +from collections.abc import Sequence + +from enum import Enum, auto + +class CardIssuer(Enum): + AmericanExpress="American Express" + +class SignUpBonus(NamedTuple): + points: int + time_months: int + spend: int + +class PointsCategory(Enum): + Hotel=auto + Travel=auto + Delta=auto + Gas=auto + Restaurant=auto + SuperMarket=auto + +class PointsType(Enum): + CashBack=auto + DeltaSkyMiles="Delta SkyMiles®" + + +@dataclass +class CreditCard: + issuer: CardIssuer + card_name: str + annual_fee: int + signup_bonus: SignUpBonus + points_type: PointsType + default_multiplier: float + category_multipliers: Sequence[Tuple[PointsCategory, float]] + other: Sequence[str] + + +credit_cards = [ + CreditCard( + CardIssuer.AmericanExpress, + "Delta SkyMiles® Reserve American Express Card", + 650, + SignUpBonus(70000, 6, 5000), + PointsType.DeltaSkyMiles, + 1, + [ + (PointsCategory.Delta, 3) + ], + [ + "15 Visits per Medallion® Year to the Delta Sky Club® when flying Delta", + "$2,500 Medallion® Qualification Dollars with MQD Headstart each Medallion Qualification Year and earn $1 MQD for each $10 in purchases", + "$240 Resy Credit", + "$120 Rideshare Credit", + "15% off when using miles to book Award Travel", + ] + ), + CreditCard( + CardIssuer.AmericanExpress, + "Delta SkyMiles® Gold American Express Card", + 150, + SignUpBonus(50000, 6, 2000), + PointsType.DeltaSkyMiles, + 1, + [ + (PointsCategory.Delta, 3) + (PointsCategory.Restaurant, 2), + (PointsCategory.SuperMarket, 2), + ], + [ + "15% off when using miles to book Award Travel", + "$200 Delta Flight Credit: After you spend $10,000 in purchases on your Card in a calendar year, you can receive a $200 Delta Flight Credit to use toward future travel.", + "$100 Delta Stays Credit: Get up to $100 back per year as a statement credit after using your Delta SkyMiles® Gold American Express Card to book prepaid hotels or vacation rentals through Delta Stays on delta.com.", + ] + ) +] + + +card_names_by_issuer = {issuer: [] for issuer in CardIssuer} + +for card in credit_cards: + card_names_by_issuer[card.issuer].append(card.card_name) \ No newline at end of file