Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Tarot Card Draws
- %{
- Using the card trick as a template for this script
- comments for the good of the order are at the end as always :)
- %}
- %% Tarot Card Draws
- clc, clear
- format long
- % Minor Arcana
- Names = {'Ace of ','Two of ','Three of ', 'Four of ', 'Five of ', ...
- 'Six of ','Seven of ', 'Eight of ', 'Nine of ', 'Ten of ', ...
- 'Page of ','Knight of ', 'Queen of ', 'King of '};
- Suits = {'Cups', 'Pentacles', 'Wands', 'Swords'};
- q = 1; % Random Number
- while q < 57 % Creates set values of cards
- for column = 1:4
- for row = 1:14
- Set_minor(q) = strcat(Names(row), Suits(column));
- q = q + 1;
- row = row + 1;
- end
- end
- end
- Set_minor = reshape(Set_minor, 1,56); % reshaping the minor array
- % Major Arcana
- Set_major = {'The Fool','The Magician','The High Priestess','The Empress',...
- 'The Emperor', 'The Hierophant','The Lovers','The Chariot',...
- 'The Strength','The Hermit','Wheel of Fortune','The Justice'...
- 'The Hanged Man', 'Death','Temperance','The Devil','The Tower'...
- 'The Star','The Moon','The Sun','Judgement','The World'};
- Set_major = reshape(Set_major, 1, 22); % reshaping the major array
- z = input('Reading with the Minor Arcana? (y/n)\n', 's');
- switch z % Choosing deck with or without minor arcana
- case char('y') % with minor
- Set = [Set_major, Set_minor];
- case char('n') % without minor
- Set = Set_major;
- end
- zz = input('Allow reverse cards? (y/n)\n','s');
- % Draws Cards
- ran_cards = randperm(length(Set),6);
- for i = 1:length(ran_cards) % Giving random number card values
- game_cards(i) = Set(ran_cards(i));
- if strcmp(zz, 'y') % Allowing cards to be reversed
- a = round(rand); % Gives 0 or 1 randomly
- switch a
- case 0 % Normal card
- case 1 % Reversed card
- game_cards(i) = strcat(game_cards(i), ' Reversed');
- end
- end
- end
- reshape(game_cards, 2, 3) % Reshapes the cards
- %{
- RUNNING INFORMATION
- requires a 'y' or 'n' input twice
- 1. for playing with or without the minor
- arcana line 40
- 2. for using reversed cards or not
- line 48
- SIDE NOTES
- Draws six cards for the reading
- Just edited this to be on one line
- ran_cards = randperm(length(Set),6);
- line 43 just change the number
- I would like to do reading formats in a
- future update
- The current format is
- cards 1 2 3
- cards 4 5 6
- EDIT HISTORY
- 6 24 2021
- added reversed format
- changed the draw format so that
- the number of cards picked in all
- scenarios can be adjusted by one line
- see side notes above
- %}
Add Comment
Please, Sign In to add comment