Okay, so I’ve been messing around with this idea for a Tarot Combination Calculator app. It all started when I was doing my usual morning reading, and I pulled The Lovers and The Chariot. I was pondering the combined meaning, and thought, “Wouldn’t it be cool if there was an app for this?”
So, I started by sketching out some basic ideas on a napkin, as you do. Just really rough stuff, you know? Like, what if I had a dropdown for the first card, another for the second, and a big ol’ “Calculate” button? Simple enough, right?
The First Steps
First thing I did was whip up a basic HTML structure. Just two select elements, a button, and a div to display the results. Nothing fancy, just getting the bare bones down.
Then I decided to use plain JavaScript. No frameworks, no libraries, just keeping it old-school. I figured, why complicate things? It’s a simple app, at least for now.
Populating the Options
Next up, I needed to get all the card names into those dropdowns. I created a simple array with all 78 Tarot card names. Major Arcana, Minor Arcana, the whole shebang.
const tarotCards = ["The Fool", "The Magician", ... , "The World", "Ace of Wands", ..., "King of Pentacles"];
I used a for loop to go through that array and create option element for each card, and the appened these option to two select tag above. Easy peasy.
The Calculation (The Tricky Part)
This is where it got a little more involved. I needed to figure out how to store and access the meanings of each card combination. I initially thought about a massive switch statement, but that quickly became a nightmare to even think about. Imagine the size of that thing!
ADVERTISEMENT
I explored the idea of using a JSON object, So, I went with a JSON object. Each key would be a card combination (like “The Fool-The Magician”), and the value would be the combined meaning.
const combinations = {
"The Fool-The Magician": "New beginnings with focused intention...",
"The Fool-The High Priestess": "Trusting your intuition on a new path...",
// ... and so on for every possible combination
Yeah, filling that object was a bit of a chore. A lot of typing, a lot of thinking about Tarot, and a lot of coffee.
Putting It All Together
Finally, I wrote the JavaScript function that would be triggered when you click the “Calculate” button.
* = "Combination not found. (Maybe I haven't added it yet!)";
It grabs the values from the two dropdowns, creates the key, and then looks up the meaning in my giant JSON object. If it finds the meaning, it displays it in the “result” div. If not, it shows a little “Combination not found” message.
The End Result (For Now)
And that’s it, basically! It’s a super simple, working Tarot combination calculator. It’s definitely not perfect, and there’s a ton of room for improvement, but it does the basic job.
I am working on how to improve it, including the way handling the meanings of the cards, may be using something outside of app’s memory.