Message
Message
BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Scanner;
} catch (IOException e) {
throw new RuntimeException(e);
}
//Bucle de juego
while(vidas>0) {
System.out.println("Vidas restantes: "+vidas);
String conjetura = sc.nextLine();
while (conjetura.length() != palabro.length()) {
System.out.println("La palabra introducida debe tener " +
palabro.length() + " carácteres");
conjetura = sc.nextLine();
}
conjetura = conjetura.toUpperCase();
if (conjetura.equals(palabro)) {
for (int i = 0; i < palabro.length(); i++) {
System.out.print(ANSI_GREEN_BACKGROUND + " " +
conjetura.charAt(i) + " " + ANSI_BLACK_BACKGROUND + " ");
}
System.out.println("\nHas ganado");
} else {
ArrayList<Character> colores = new ArrayList<>();
for (int i = 0; i < conjetura.length(); i++) {
colores.add('g');
}