Skip to content

Commit f9557a9

Browse files
Merge pull request avinashkranjan#848 from Akshu-on-github/tarot-reader
Tarot reader
2 parents 617478e + 8fbeed0 commit f9557a9

File tree

3 files changed

+214
-0
lines changed

3 files changed

+214
-0
lines changed

Tarot Reader/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Tarot Reader
2+
3+
This is a python script that draws three cards from a pack of 78 cards and gives fortunes for the same. As it was originally created as a command line game, it doesn't have a GUI
4+
5+
## Setup instructions
6+
To run the script locally,
7+
- Install Python3
8+
- Import the random library
9+
- Download tarot_card_reader.py
10+
- Run tarot_card_reader.py
11+
12+
## Output
13+
14+
A sample output of the script on repl.it,
15+
16+
<img width="460" alt="screenshot-introduction" src="https://user-images.githubusercontent.com/61582763/113908975-cbaf2680-97f4-11eb-804b-750bf9232ec2.PNG">
17+
18+
<img width="460" alt="screenshot-three-tarots-drawn" src="https://user-images.githubusercontent.com/61582763/113909006-d7025200-97f4-11eb-9784-cfc91fbb138c.PNG">
19+
20+
<img width="460" alt="screenshot-conclusion" src="https://user-images.githubusercontent.com/61582763/113909023-db2e6f80-97f4-11eb-8b8e-07e950aba52b.PNG">
21+
22+
## Author
23+
[Akshaya Kulasekaran](https://github.com/Akshu-on-github)
24+
25+
## Disclaimer
26+
The `fortunes` drawn are often quotes/references and should be taken in humour

Tarot Reader/tarot.txt

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
The Fool: Experience is your best teacher
2+
The Magician: Life is Magic... do you control yours?
3+
The High Priestess: Stay away from worldly affairs
4+
The Empress: The world bows before you, you bow to none
5+
The Emperor: The world bows before you, you bow to none
6+
The Hierophant: Follow the 4rc@n3 principles
7+
The Lovers: I've never writ, nor no man never loved
8+
The Chariot: You'll get to see your dream ride soon
9+
Strength: You are strong enough
10+
The Hermit: The World hurtles forward, yet you remain uncaught in its riptide
11+
Wheel of Fortune: Your luck today depends on whether the first living thing you see is a plant or an animal
12+
Justice: The Mills of God grind slow but fine
13+
The Hanged Man: That's rough buddy
14+
Death: Life's younger sibling brushed your shoulder just now, but you're fine- it was just lint
15+
Temperance: The World needs more of it, and of you
16+
The Devil: Get over here so I can prove that you exist
17+
The Tower: Exchange places with the king
18+
The Star: Like diamonds in the sky~
19+
The Moon: You might find that your enthusiasm waxes and wanes, but that's alright
20+
The Sun: You're the light of someone's life
21+
Judgement: *judges you in Spanish*
22+
The World: These hands could hold you but it'll never be enough~
23+
Ace of Wands: You're a wizard, Harry
24+
Two of Wands: Your sibling is pretty cool
25+
Three of Wands: Try to avoid tournaments for the time being
26+
Four of Wands: Find trouble and make it double
27+
Five of Wands: Expecto Patronum!
28+
Six of Wands: Draw your wand
29+
Seven of Wands: If you see a noseless man with the complexion of crushed eggshells, RUN
30+
Eight of Wands: I'm surprised you got this tbh... I'll let you in on a secret - Seven didn't actually eat Nine
31+
Nine of Wands: Oh, the card you're looking for is 3 quarters to the right
32+
Ten of Wands: Oh, the card you're looking for is a quarter to the left
33+
Page of Wands: You're going to be called to the Head's Office - you shouldn't have messed with alchemy unsupervised
34+
Knight of Wands: You just had to buy that giant chess set, didn't you?
35+
Queen of Wands: With great power...
36+
King of Wands: With great power...
37+
Ace of Cups: If you ever see a trophy in the middle of a hedge maze...
38+
Two of Cups: Bottoms up, friend!
39+
Three of Cups: Two's company, three's better company!
40+
Four of Cups: The more the merrier!
41+
Five of Cups: Yeah, social distancing is important
42+
Six of Cups: Now that's one too many
43+
Seven of Cups: Two's company enough
44+
Eight of Cups: Take a break
45+
Nine of Cups: If three's a crowd...
46+
Ten of Cups: Stop it now
47+
Page of Cups: I don't think you should drive until you clear your head
48+
Knight of Cups: Put that sword down right this instant
49+
Queen of Cups: Don't offend anyone influential
50+
King of Cups: Don't get on your gaurdians' bad side
51+
Ace of Swords: Draw your sword
52+
Two of Swords: En garde
53+
Three of Swords: Allez!
54+
Four of Swords: Parry!
55+
Five of Swords: Learn enough to be dangerous
56+
Six of Swords: Get yourself a teacher
57+
Seven of Swords: Parlay!
58+
Eight of Swords: Do something nice for a stranger
59+
Nine of Swords: Be chivalrous
60+
Ten of Swords: I'm not asking for much, just be nice
61+
Page of Swords: The pen is mightier
62+
Knight of Swords: Live by the code you're honour-bound to follow
63+
Queen of Swords: Pledge alliance
64+
King of Swords: Pledge alliance
65+
Ace of Coins: You now have an iron nail
66+
Two of Coins: Flip a coin
67+
Three of Coins: For want of a nail...
68+
Four of Coins: You now have a paperclip
69+
Five of Coins: Sleep well, it is a blessing
70+
Six of Coins: Roll a die
71+
Seven of Coins: You're a lucky one
72+
Eight of Coins: You're like a pineapple tree - i.e. you're a factual error
73+
Nine of Coins: Accessory fruit (affectionate)
74+
Ten of Coins: <insert cool fruit fact here>
75+
Page of Coins: You're due for a promotion soon
76+
Knight of Coins: Treat your subordinates
77+
Queen of Coins: You're worth your weight in gold
78+
King of Coins: You're worth your weight in gold

Tarot Reader/tarot_card_reader.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import random
2+
3+
4+
# get tarot deck of 78 cards and 'predictions' from tarot.txt
5+
file_handle = open("./Tarot Reader/tarot.txt", "r")
6+
cards = file_handle.readlines()
7+
tarot_deck = []
8+
for card in cards:
9+
tarot_deck.append(card)
10+
11+
12+
# Close file, display outro text
13+
def fin():
14+
file_handle.close()
15+
print("Whichever your choice was...")
16+
input(">> press enter")
17+
print("May the cards ever be in your favour")
18+
input(">> press enter")
19+
print()
20+
print("\x1B[3mFin\x1B[23m".center(72))
21+
print("*"*72)
22+
23+
24+
# Display when 'Y' or 'y' is entered
25+
def youve_chosen_yes():
26+
print("I see that you've chosen to divine your future....")
27+
input(">> press enter")
28+
print("Let's make haste then...")
29+
input(">> press enter")
30+
print("Neither fame nor fortune wait for man")
31+
input(">> press enter")
32+
print()
33+
print("You have drawn three cards")
34+
print()
35+
print("Your first card is...")
36+
pick_card1 = random.randint(0, 77)
37+
print(tarot_deck[pick_card1])
38+
input(">> press enter")
39+
print()
40+
print("Your second card is...")
41+
pick_card2 = random.randint(0, 78)
42+
print(tarot_deck[pick_card2] if pick_card2 != pick_card1 else tarot_deck[random.randint(0, 78)])
43+
input(">> press enter")
44+
print()
45+
print("And your third and final card is...")
46+
pick_card3 = random.randint(0, 78)
47+
print(tarot_deck[pick_card3] if pick_card3 != pick_card1 and pick_card3 != pick_card2 else tarot_deck[random.randint(0, 78)])
48+
input(">> press enter")
49+
print()
50+
fin()
51+
52+
53+
# Display when 'N' or 'n' is entered
54+
def youve_chosen_no():
55+
print("Are you wise...")
56+
input(">> press enter")
57+
print("Or foolish?")
58+
input(">> press enter")
59+
print("I suppose only time will tell")
60+
input(">> press enter")
61+
fin()
62+
63+
64+
# Handles other cases
65+
def youve_chosen_neither():
66+
print("*le sigh*")
67+
input(">> press enter")
68+
print("I suppose you think this is a game...")
69+
input(">> press enter")
70+
print("You wouldn't be wrong...")
71+
input(">> press enter")
72+
print("But the only thing that you've played...")
73+
input(">> press enter")
74+
print("Is yourself.")
75+
input(">> press enter")
76+
print("\nNever gonna give you up,\nNever gonna let you down,\nNever gonna run around and desert you.\nNever gonna make you cry,\nNever gonna say goodbye,\nNever gonna tell a lie and hurt you.\n")
77+
fin()
78+
79+
80+
# Intro text
81+
print("In this black box, you read white words")
82+
input(">> press enter")
83+
print("Words that might warn you of danger...")
84+
input(">> press enter")
85+
print("Words that might foretell great fortune...")
86+
input(">> press enter")
87+
print("Or words that might make you laugh")
88+
input(">> press enter")
89+
print()
90+
91+
92+
# Choice made here
93+
print("Do you dare draw a card?")
94+
ch = input(">> enter Y/n: ")
95+
print("\nInteresting...")
96+
97+
98+
# Driver code
99+
if ch.lower() == 'y':
100+
print()
101+
youve_chosen_yes()
102+
103+
elif ch.lower()=='n':
104+
print()
105+
youve_chosen_no()
106+
107+
else:
108+
print()
109+
youve_chosen_neither()
110+

0 commit comments

Comments
 (0)