I am doing a "Rock,Paper,Scissors" game with Java and I have a question, is there any way to create and Array with answers and check if any of these values equal to another array? For example:
Here is the answerArray (also I want to have short cuts for answers):
String[] answersArray = {"Rock","R","Paper","P","Scissors","S"};
And here is a randomArray for computer:
String[] npcAnswer = {"Rock","Paper","Scissors"};
int idx = new Random().nextInt(npcAnswer.length);
String npcRandomAnswer = (npcAnswer[idx]);
So, I want to check through the scanner if my answer (answersArray) equal to npcRandomAnswer.
Sorry if I have grammar mistakes, I did my best to explain my point.
Thank you.
Aucun commentaire:
Enregistrer un commentaire