Skip to content

Commit

Permalink
Merge pull request #2872 from Qv1ko/main
Browse files Browse the repository at this point in the history
Reto #13 - Java
  • Loading branch information
mouredev authored Apr 4, 2023
2 parents 9e0a56e + f429af7 commit 3171945
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Retos/Reto #13 - ADIVINA LA PALABRA [Media]/java/Qv1ko.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ private static void guessTheWord(String keyWord) {
System.out.println("The word is \""+misteryWord+"\"");
System.out.print("Attempt ("+(i+1)+"/"+keyWord.length()+"): ");
attemp=sc.nextLine();
if(attemp.equalsIgnoreCase(keyWord)) {
guessed=true;
break;
if(attemp.length()==keyWord.length()) {
if(attemp.equalsIgnoreCase(keyWord)) {
guessed=true;
break;
}
} else if(attemp.length()==1) {
for(int j=0;j<misteryWord.length();j++) {
if(keyWord.toCharArray()[j]==attemp.charAt(0)) {
Expand All @@ -38,7 +40,7 @@ private static void guessTheWord(String keyWord) {
break;
}
}
System.out.println((guessed)? "\nYou guessed the word "+keyWord+"\n":"\nYou didn't guess\n");
System.out.println((guessed)? "\nYou guessed the word\n":"\nYou finished your attempts, the word was "+keyWord+"\n");
sc.close();
} else {
System.out.println("Choose a keyword");
Expand Down

0 comments on commit 3171945

Please sign in to comment.