What does Tarot reading have to do with coding?
Tags: python, programming, computerscience
Published: 2021-05-16 12:08:07

Very little, acturally, unless you find yourself stuck for ideas for a portfolio project on Codecademy and really want to get going with the coding bit.

That was my starting point. This is the final part of the excercise: "Write a blog post about your program".

The program is written in Python3. It is named "Mme Nugget's Tarot Reading" after my son's guinea pig. If you decide to try the program, be warned that it offers only guaranteed useless advice, occasionally bordering on rude or harmful.

A basic run goes like this:

1. Greeting
2. Offers a choice of questions for the reading
3. Picks a random card
4. Delivers a reading of the card in relation to the question
5. Offers another reading or to quit
6. If another reading is chosen, the program starts again from 2
7. Else, Thank you for your visit!

It's a simple enough program. I endeavoured to set it up with a view to make it easy to add to it and increase the complexity later on: 

The cards and the questions are declared in two separate files from which they are imported for use in the main file. At present, there are only two cards and three questions, which is all I needed to test the code.

The program is put together from small, simple functions which may be run, improved and tested separately.

You can see the program here: https://github.com/Randi-Seeberg/tarot_reading

The learning process
An important part of the process was setting up my coding environment and start coding on my own computer, using Visual Studio Code and version control. Getting it to cooperate properly with the Anaconda Prompt was a challenge, but an internet search provided me with a solution. I have had an account on GitHub for a while but actually programming locally and pushing all changes to my program's repository on GitHub was new to me.

Getting a push in the direction of where to join and write a blog post about my work was also part of the learning process.

Thoughts about improving the program
As the program currently has only three questions and two Tarot card to work with, the possible output is somewhat limited. It would be a big improvement to have more of both. However, as the program provides a reading based on the combination of a card and a question, every card must have as many readings as there are questions. Two cards times three questions amounts to six readings. To step that up would mean a lot of additional textwork. As much as I enjoy offering useless advice, I decided to leave that part of the program as it is.

I liked the idea of being able to easily add questions or cards to the program, which is why in the 'questions' file, there is function called 'add_question'. However, I have not yet learned how to store the added questions and make them available for next time I open the program. I need to find out how to do that.

For adding cards, it's a little more complicated, as each card is a dict item with (name:[reading1, reading2, etc.]). This means that every time a new card is set up, it needs to get the current length of the 'questions' dict in order to know how many readings must be in the value list of the card.

To simulate something closer to a real-life Tarot reading, the program could ask the user to allow reversed cards in the deck. This would make readings more interesting but again double up on the aforementioned textwork.

If you got this far, thank you for your time! You can have a free test run at Mme Nugget's Tarot Reading anytime.