|
| 1 | +#!/usr/bin/env python3 |
| 2 | +""" |
| 3 | +Personalized Tarot Card Pull |
| 4 | +Draws tarot cards based on user input for personalized readings |
| 5 | +""" |
| 6 | + |
| 7 | +import random |
| 8 | +import hashlib |
| 9 | +from datetime import datetime |
| 10 | + |
| 11 | +# Major Arcana cards with meanings |
| 12 | +MAJOR_ARCANA = { |
| 13 | + "The Fool": "New beginnings, innocence, spontaneity", |
| 14 | + "The Magician": "Manifestation, resourcefulness, power", |
| 15 | + "The High Priestess": "Intuition, sacred knowledge, divine feminine", |
| 16 | + "The Empress": "Femininity, beauty, nature, abundance", |
| 17 | + "The Emperor": "Authority, establishment, structure", |
| 18 | + "The Hierophant": "Spiritual wisdom, tradition, conformity", |
| 19 | + "The Lovers": "Love, harmony, relationships, choices", |
| 20 | + "The Chariot": "Control, willpower, victory", |
| 21 | + "Strength": "Inner strength, courage, compassion", |
| 22 | + "The Hermit": "Soul searching, introspection, solitude", |
| 23 | + "Wheel of Fortune": "Good luck, karma, life cycles", |
| 24 | + "Justice": "Justice, fairness, truth, cause and effect", |
| 25 | + "The Hanged Man": "Pause, surrender, letting go", |
| 26 | + "Death": "Endings, transformation, transition", |
| 27 | + "Temperance": "Balance, moderation, patience", |
| 28 | + "The Devil": "Shadow self, attachment, addiction", |
| 29 | + "The Tower": "Sudden change, upheaval, revelation", |
| 30 | + "The Star": "Hope, faith, purpose, renewal", |
| 31 | + "The Moon": "Illusion, fear, anxiety, subconscious", |
| 32 | + "The Sun": "Positivity, fun, warmth, success", |
| 33 | + "Judgement": "Reflection, reckoning, awakening", |
| 34 | + "The World": "Completion, accomplishment, travel" |
| 35 | +} |
| 36 | + |
| 37 | +def get_personalized_seed(name, birthdate, question): |
| 38 | + """Generate a personalized seed from user information""" |
| 39 | + combined = f"{name.lower()}{birthdate}{question.lower()}{datetime.now().date()}" |
| 40 | + return int(hashlib.md5(combined.encode()).hexdigest(), 16) |
| 41 | + |
| 42 | +def draw_cards(num_cards, seed=None): |
| 43 | + """Draw specified number of tarot cards""" |
| 44 | + if seed: |
| 45 | + random.seed(seed) |
| 46 | + cards = list(MAJOR_ARCANA.items()) |
| 47 | + return random.sample(cards, min(num_cards, len(cards))) |
| 48 | + |
| 49 | +def display_reading(cards, question, name): |
| 50 | + """Display the tarot reading in a formatted way""" |
| 51 | + print("\n" + "="*60) |
| 52 | + print(f" Personalized Tarot Reading for {name}") |
| 53 | + print("="*60) |
| 54 | + print(f"\nQuestion: {question}\n") |
| 55 | + |
| 56 | + positions = ["Past", "Present", "Future"] if len(cards) == 3 else [f"Card {i+1}" for i in range(len(cards))] |
| 57 | + |
| 58 | + for i, (card, meaning) in enumerate(cards): |
| 59 | + position = positions[i] if i < len(positions) else f"Card {i+1}" |
| 60 | + print(f"\n{position}: {card}") |
| 61 | + print(f"Meaning: {meaning}") |
| 62 | + print("-" * 60) |
| 63 | + |
| 64 | +def main(): |
| 65 | + print("Welcome to Personalized Tarot Card Pull!\n") |
| 66 | + |
| 67 | + name = input("Enter your name: ").strip() |
| 68 | + birthdate = input("Enter your birthdate (YYYY-MM-DD): ").strip() |
| 69 | + question = input("What question do you seek guidance on? ").strip() |
| 70 | + |
| 71 | + print("\nHow many cards would you like to draw?") |
| 72 | + print("1 - Single card (Quick insight)") |
| 73 | + print("3 - Three-card spread (Past, Present, Future)") |
| 74 | + print("5 - Five-card spread (Detailed reading)") |
| 75 | + |
| 76 | + try: |
| 77 | + num_cards = int(input("\nEnter number (1, 3, or 5): ")) |
| 78 | + if num_cards not in [1, 3, 5]: |
| 79 | + num_cards = 3 |
| 80 | + except ValueError: |
| 81 | + num_cards = 3 |
| 82 | + |
| 83 | + seed = get_personalized_seed(name, birthdate, question) |
| 84 | + drawn_cards = draw_cards(num_cards, seed) |
| 85 | + display_reading(drawn_cards, question, name) |
| 86 | + |
| 87 | + print("\n" + "="*60) |
| 88 | + print("Thank you for using Personalized Tarot Card Pull!") |
| 89 | + print("="*60 + "\n") |
| 90 | + |
| 91 | +if __name__ == "__main__": |
| 92 | + main() |
0 commit comments