import java.util.Random;
import java.util.Scanner;
public class JuegoDeAdivinacion {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
int numeroSecreto = new Random().nextInt(100);
System.out.println(numeroSecreto);
int totalIntentos = 4;
System.out.println("Adivina el numero secreto que esta entre 0 y 100: ");
int numeroUsuario = teclado.nextInt();
while (numeroUsuario!=numeroSecreto && totalIntentos>0){
if(numeroUsuario<numeroSecreto){
System.out.println("Te quedan "+totalIntentos+" intentos, prueba con un numero mayor: ");
numeroUsuario = teclado.nextInt();
}else{
System.out.println("Te quedan "+totalIntentos+" intentos, prueba numero menor: ");
numeroUsuario = teclado.nextInt();
}
totalIntentos--;
}
if(numeroUsuario!=numeroSecreto){
System.out.println("Lo siento, tus intentos terminaron, has perdido el juego! :(");
}
else{
System.out.println("Felicidades, el numero secreto es "+numeroSecreto+", has ganado el juego! :)");
}
}
}