import java.util.Scanner;
public class Demo
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("你做好准备了吗?");
int over = (int) ((Math.random()) * 100);
System.out.println(over);
int min = 0, max = 100, temp;
String y = sc.next();
while (true)
{
if (y.equals("yes"))
{
System.out.println("游戏开始,请输入一个你认为炸弹存在的数:");
while (true)
{
temp = sc.nextInt();
if (temp > over)
{
if (temp > max)
{
System.out.println("你输入的数太大了!请继续输入你认为存在的数:");
}
else
{
max = temp;
}
System.out.println("当前的数字区间在:" + min + "---" + max);
System.out.println("请继续输入你认为存在的数:");
}
else if (temp < over)
{
if (temp < min)
{
System.out.println("你输入的数太小了!请继续输入你认为存在的数:");
}
else
{
min = temp;
}
System.out.println("当前的数字区间在:" + min + "---" + max);
System.out.println("请继续输入你认为存在的数:");
}
else
{
System.out.println("恭喜猜中了!!!");
System.out.println("还要在猜吗?(yes/no)?");
y = sc.next();
if (y.equals("yes"))
{
over = (int) ((Math.random()) * 100);
System.out.println(over);
continue;
}
else if (y.equals("no"))
{
break;
}
}
}
}
else if (y.equals("no"))
{
System.out.println("那好吧,等你做好准备再来吧。");
break;
}
else
{
System.out.println("请根据提示输入!!");
y = sc.next();
}
}
sc.close();
}
}