Files
2025-10-08 15:33:06 +02:00

23 lines
635 B
Java

import java.util.Set;
public class Display {
public static void showWord(String word, Set<Character> guessedLetters) {
StringBuilder sb = new StringBuilder();
for (char c : word.toCharArray()) {
if (c == ' ') {
sb.append(" ");
} else if (guessedLetters.contains(c)) {
sb.append(c).append(" ");
} else {
sb.append("_ ");
}
}
System.out.println(sb.toString());
}
public static void showLives(int lives, int maxLives) {
System.out.println("Lives: " + lives + " / " + maxLives);
}
}