Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class TarotCards {
- public static Random draw = new Random();
- public static Scanner scan = new Scanner(System.in);
- public static int numDraws=0;
- public static int theCard;
- public static void main(String[] args) {
- //A total of 78 cards
- //System.out.println(draw.nextInt(78)+1);
- String again="";
- while(!again.contains("n")){
- System.out.println("How many cards do you want to draw?");
- numDraws=scan.nextInt();
- while(numDraws>77){
- System.out.println("Too many cards.");
- System.out.println("How many cards do you want to draw?");
- numDraws=scan.nextInt();
- }
- System.out.println("Cards drawn:\n");
- int [] cardsDrawn = new int[numDraws];
- for(int i=0; i<numDraws; i++){
- theCard=draw.nextInt(78);
- checkDupe(cardsDrawn);
- cardsDrawn[i]=theCard;
- System.out.println(getCard(theCard));
- }
- System.out.println("\nContinue?");
- again=scan.next();
- System.out.println();
- }
- /*
- String cont ="";
- while(!cont.contains("n")){
- System.out.print("Enter a number: ");
- theCard=scan.nextInt();
- System.out.println(getCard(theCard));
- System.out.println("Continue?");
- cont=scan.nextLine();
- }
- */
- }
- public static void checkDupe(int[] cards){
- for(int i=0; i<cards.length; i++){
- if(cards[i]==theCard){
- theCard=draw.nextInt(78);
- checkDupe(cards);
- }
- }
- }
- public static String getCard(int num){
- String inversed = "";
- if(draw.nextBoolean())
- inversed = " inversed";
- if(num<22){
- return majorArcana(num)+inversed;
- }
- else
- return minorArcana(num)+inversed;
- }
- public static String minorArcana(int num){
- String suit="";
- String space="";
- int card=0;
- if(22<=num && num<36){
- suit="pentacles";
- card=num-21;
- }
- if(36<=num && num<50){
- suit="swords";
- card=num-35;
- }
- if(50<=num && num<64){
- suit="wands";
- card=num-49;
- }
- if(64<=num && num<=77){
- suit="cups";
- card=num-63;
- }
- String newCard=facedCards(card);
- return newCard+" of "+suit;
- /*
- pentacles, swords, wands, and cups
- king, queen, knight and page and then 10-1 in the numbers
- */
- }
- public static String facedCards(int num){
- if(num==11)
- return "page";
- if(num==12)
- return "knight";
- if(num==13)
- return "queen";
- if(num==14)
- return "king";
- else
- return num+"";
- }
- public static String majorArcana(int num){
- if(num==0)
- return "the fool";
- if(num==1)
- return "the magician";
- if(num==2)
- return "the high priestess";
- if(num==3)
- return "the empress";
- if(num==4)
- return "the emperor";
- if(num==5)
- return "the hierophant";
- if(num==6)
- return "the lovers";
- if(num==7)
- return "the chariot";
- if(num==8)
- return "strength";
- if(num==9)
- return "the hermit";
- if(num==10)
- return "the wheel of fortune";
- if(num==11)
- return "justice";
- if(num==12)
- return "the hanged man";
- if(num==13)
- return "death";
- if(num==14)
- return "temperance";
- if(num==15)
- return "the devil";
- if(num==16)
- return "the tower";
- if(num==17)
- return "the star";
- if(num==18)
- return "the moon";
- if(num==19)
- return "the sun";
- if(num==20)
- return "judgement";
- else
- return "the world";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement