Tarot card in pydroid, 3 draw and celtic cross

import random

# === TAROT DECK DEFINITIONS ===

major_arcana = {
    “The Fool”: (“Beginnings, innocence, spontaneity”, “Recklessness, naivety”),
    “The Magician”: (“Manifestation, resourcefulness”, “Manipulation, deception”),
    “The High Priestess”: (“Intuition, mystery”, “Hidden motives, ignoring intuition”),
    “The Empress”: (“Fertility, nurturing”, “Dependency, creative blocks”),
    “The Emperor”: (“Authority, structure”, “Tyranny, rigidity”),
    “The Hierophant”: (“Tradition, learning”, “Rebellion, nonconformity”),
    “The Lovers”: (“Love, harmony, union”, “Disharmony, imbalance”),
    “The Chariot”: (“Willpower, victory”, “Lack of direction”),
    “Strength”: (“Courage, compassion”, “Doubt, insecurity”),
    “The Hermit”: (“Introspection, solitude”, “Isolation, withdrawal”),
    “Wheel of Fortune”: (“Luck, destiny”, “Resistance to change”),
    “Justice”: (“Truth, fairness”, “Injustice, dishonesty”),
    “The Hanged Man”: (“Letting go, perspective”, “Stalling, martyrdom”),
    “Death”: (“Endings, transformation”, “Resistance to change”),
    “Temperance”: (“Balance, moderation”, “Excess, imbalance”),
    “The Devil”: (“Addiction, materialism”, “Freedom, release”),
    “The Tower”: (“Sudden change, upheaval”, “Avoiding disaster”),
    “The Star”: (“Hope, renewal”, “Despair, lack of faith”),
    “The Moon”: (“Illusion, intuition”, “Confusion, clarity”),
    “The Sun”: (“Joy, success”, “Negativity, sadness”),
    “Judgement”: (“Reflection, rebirth”, “Guilt, refusal to change”),
    “The World”: (“Completion, achievement”, “Lack of closure”)
}

suits = {
    “Cups”: “Emotions, relationships”,
    “Pentacles”: “Material, work, finances”,
    “Swords”: “Thought, conflict, logic”,
    “Wands”: “Action, creativity, passion”
}

ranks = {
    “Ace”: (“New beginnings in”, “Blocked energy in”),
    “Two”: (“Balance and partnership in”, “Imbalance and indecision in”),
    “Three”: (“Growth and collaboration in”, “Miscommunication or delay in”),
    “Four”: (“Stability and rest in”, “Stagnation or boredom in”),
    “Five”: (“Conflict and change in”, “Recovery or resolution in”),
    “Six”: (“Harmony and support in”, “Lack of help or imbalance in”),
    “Seven”: (“Challenges and perseverance in”, “Giving up or overwhelm in”),
    “Eight”: (“Movement and focus in”, “Distraction or lack of direction in”),
    “Nine”: (“Fulfillment and satisfaction in”, “Overindulgence or dissatisfaction in”),
    “Ten”: (“Completion and legacy in”, “Burden or burnout in”),
    “Page”: (“Curiosity and new ideas in”, “Immaturity or distraction in”),
    “Knight”: (“Action and pursuit in”, “Recklessness or inaction in”),
    “Queen”: (“Maturity and nurturing in”, “Coldness or dependence in”),
    “King”: (“Mastery and leadership in”, “Control issues or arrogance in”)
}

# === DECK CREATION ===

def build_tarot_deck():
    deck = {}
    for name, meanings in major_arcana.items():
        deck[name] = {“upright”: meanings[0], “reversed”: meanings[1]}
    for suit, theme in suits.items():
        for rank, meanings in ranks.items():
            card = f”{rank} of {suit}”
            up = f”{meanings[0]} {theme.lower()}”
            rev = f”{meanings[1]} {theme.lower()}”
            deck[card] = {“upright”: up, “reversed”: rev}
    return deck

def draw_card(deck):
    card = random.choice(list(deck.keys()))
    is_rev = random.choice([True, False])
    orientation = “Reversed” if is_rev else “Upright”
    meaning = deck[card][“reversed” if is_rev else “upright”]
    return card, orientation, meaning

# === FORMATTING OPTIONS ===

def format_plain(title, entries):
    out = f”{title}\n\n”
    for label, card, orient, meaning in entries:
        out += f”{label}: {card} ({orient})\nMeaning: {meaning}\n\n”
    return out.strip()

def format_blog(title, entries):
    out = f”## {title}\n\n”
    for label, card, orient, meaning in entries:
        out += f”**{label}: {card}** *({orient})*\n→ {meaning}\n\n”
    return out.strip()

def format_bluesky(title, entries):
    lines = [f”{title} šŸ”®”]
    for label, card, orient, meaning in entries:
        short = meaning.split(“,”)[0].strip()
        emoji = “šŸŒž” if orient == “Upright” else “šŸŒ’”
        lines.append(f”{label}: {card} {emoji} — {short}”)
    lines.append(“#Tarot #Divination #CelticCross” if “Celtic” in title else “#TarotReading #3CardSpread”)
    return “\n”.join(lines)

def share_output(title, entries):
    print(“\nChoose format:”)
    print(“1. Plain”)
    print(“2. Blog”)
    print(“3. Bluesky”)
    style = input(“Select (1–3): “).strip()

    if style == “2”:
        output = format_blog(title, entries)
    elif style == “3”:
        output = format_bluesky(title, entries)
    else:
        output = format_plain(title, entries)

    print(“\n>>> COPY BELOW >>>\n”)
    print(output)
    print(“\n<<< END <<<“)

# === SPREADS ===

def three_card_spread(deck):
    labels = [“Past”, “Present”, “Future”]
    entries = []
    for label in labels:
        card, orient, meaning = draw_card(deck)
        entries.append((label, card, orient, meaning))
    share_output(“3-Card Tarot Spread”, entries)

def celtic_cross_spread(deck):
    positions = [
        “1. Present Situation”,
        “2. Immediate Challenge”,
        “3. Subconscious Influence”,
        “4. Past Influence”,
        “5. Conscious Goal”,
        “6. Near Future”,
        “7. Self / Attitude”,
        “8. Environment”,
        “9. Hopes & Fears”,
        “10. Final Outcome”
    ]
    used = set()
    entries = []
    for label in positions:
        while True:
            card, orient, meaning = draw_card(deck)
            if card not in used:
                used.add(card)
                entries.append((label, card, orient, meaning))
                break
    share_output(“Celtic Cross Spread”, entries)

# === MAIN ===

def main():
    tarot = build_tarot_deck()
    print(“=== Tarot Divination ===”)
    print(“1. 3-Card Spread”)
    print(“2. Celtic Cross Spread”)
    choice = input(“Choose your spread (1 or 2): “).strip()
    if choice == “1”:
        three_card_spread(tarot)
    elif choice == “2”:
        celtic_cross_spread(tarot)
    else:
        print(“Invalid input. Try again.”)

if __name__ == “__main__”:
    main()

Leave a Reply