mercredi 24 octobre 2018

High Low Card Game

Basically, i'm currently coding a game which gives a random card and asks if the next card will be higher, lower or equal. The problem is I'm struggling to find a way to list for example when I get a 13 to list it as a King I tried doing below as like an 'either or' statement but it says || is undefined for this kind of statement

 System.out.print("The card is " + ((cardToGuess == 8)||(cardToGuess == ACE) ? "an ":"a ") + ((cardToGuess == ACE) ? "Ace " : cardToGuess)||
                  ((cardToGuess == JACK) ? "Jack " : cardToGuess)||((cardToGuess == QUEEN) ? "Queen " : cardToGuess)||
                  ((cardToGuess == KING) ? "King " : cardToGuess)  
                  + "\nDo you think the next card will be higher, lower, or equal? ");

I know this || can't be used here but i want to know if there is a way around this Also a way to make a random number generator to 13 that doesn't include 0 would be nice aswell I'm new to coding so any help I'd appreciate it being as simplified as possible




Aucun commentaire:

Enregistrer un commentaire