From ca4f8d3dd68fff843c6280ce7dd093ffe3a3e444 Mon Sep 17 00:00:00 2001 From: Elias Bachaalany Date: Tue, 26 Dec 2023 18:35:19 -0800 Subject: [PATCH] Create tarot_reading_updated.py added translated script --- .../tarot_reading_updated.py | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 prompts/gpts/knowledge/1111 Eternal Wisdom Portal/tarot_reading_updated.py diff --git a/prompts/gpts/knowledge/1111 Eternal Wisdom Portal/tarot_reading_updated.py b/prompts/gpts/knowledge/1111 Eternal Wisdom Portal/tarot_reading_updated.py new file mode 100644 index 0000000..fdc64c8 --- /dev/null +++ b/prompts/gpts/knowledge/1111 Eternal Wisdom Portal/tarot_reading_updated.py @@ -0,0 +1,66 @@ +# Translated version of the provided Python code + +import random +import json +import sys + +# Define the Major Arcana +major_arcana = [ + 'The Magician', 'The High Priestess', 'The Empress', 'The Emperor', + 'The Hierophant', 'The Lovers', 'The Chariot', 'Justice', + 'The Hermit', 'Wheel of Fortune', 'Strength', 'The Hanged Man', + 'Death', 'Temperance', 'The Devil', 'The Tower', + 'The Star', 'The Moon', 'The Sun', 'Judgment', 'The World', 'The Fool' +] + +# Function to generate the Minor Arcana +def generate_minor_arcana(): + suits = ['Wands', 'Cups', 'Swords', 'Pentacles'] + figures = ['Ace', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Page', 'Knight', 'Queen', 'King'] + minor_arcana = [] + + for suit in suits: + for figure in figures: + minor_arcana.append(f'{figure} of {suit}') + + return minor_arcana + +# Add the Minor Arcana to the Major to have the complete list of tarot cards +tarot_cards = major_arcana + generate_minor_arcana() + +# Function to simulate a tarot reading +def tarot_reading(spread): + reading = {'cards': []} + number_of_cards = 1 # Default one card + + if spread == 'three-card': + number_of_cards = 3 + elif spread == 'celtic-cross': + number_of_cards = 10 + elif spread == 'single-card': # Added to allow the drawing of a single card + number_of_cards = 1 + + # Ensure that cards do not repeat in a reading + selected_cards = random.sample(tarot_cards, number_of_cards) + + for card in selected_cards: + position = random.choice(['upright', 'reversed']) + reading['cards'].append({'name': card, 'position': position}) + + return reading + +# This would be the function that receives the call from GPT-4 +def function_calling(spread_type): + # Get the result of the reading + reading_result = tarot_reading(spread_type) + + # Convert the result to JSON for output + print(json.dumps(reading_result)) + +if __name__ == "__main__": + # Take the type of spread from the command line + if len(sys.argv) < 2: + print("Usage: python tarot.py [single-card | three-card | celtic-cross]") + else: + spread_type = sys.argv[1] + function_calling(spread_type)