So, I have a loop that uses the Scanner to input 3 separate pieces of user input, 2 ints and a String. The ints work just fine, but the String input is not working. It skips over the iput for the String, and just loops around to ask for the int again.
for(int e = 10; e > 5; e++)
{
System.out.println("Enter the Y coordinate of your guess. The upper left corner is 0, and the lower left is 7");
int guessY = inputDevice.nextInt();
System.out.println("Enter the X coordinate of your guess. The upper left corner is 0, and the upper right is 7");
int guessX = inputDevice.nextInt();
display[guessX][guessY] = map[guessX][guessY];
for(int j = 0; j < 8; j++)
{
for(int t = 0; t < 8; t++)
{
System.out.print(display[j][t] + " ");
}
System.out.println();
}
System.out.println("Enter go when you are ready to make another move.");
System.out.println("Enter quit to give up");
String cont = inputDevice.nextLine();
if(cont.equalsIgnoreCase("quit"))
{
System.out.println("Weenie.");
System.exit(0);
} else if(cont.equalsIgnoreCase("go")) {
for(int i = 0; i < 100; i++)
System.out.println("\b");
}
if(map[guessX][guessY] == '0')
{
if(map[guessX - 1][guessY - 1] == '0')
display[guessX - 1][guessY - 1] = map[guessX - 1][guessY - 1];
if(map[guessX - 1][guessY + 0] == '0')
display[guessX - 1][guessY + 0] = map[guessX - 1][guessY + 0];
if(map[guessX - 1][guessY + 1] == '0')
display[guessX - 1][guessY + 1] = map[guessX - 1][guessY + 1];
if(map[guessX + 0][guessY - 1] == '0')
display[guessX + 0][guessY - 1] = map[guessX + 0][guessY - 1];
if(map[guessX + 0][guessY + 1] == '0')
display[guessX + 0][guessY + 1] = map[guessX + 0][guessY + 1];
if(map[guessX + 1][guessY - 1] == '0')
display[guessX + 1][guessY - 1] = map[guessX + 1][guessY - 1];
if(map[guessX + 1][guessY + 0] == '0')
display[guessX + 1][guessY + 0] = map[guessX + 1][guessY + 0];
if(map[guessX + 1][guessY + 1] == '0')
display[guessX + 1][guessY + 1] = map[guessX + 1][guessY + 1];
}
if(display[guessX][guessY] == 'M')
{
System.out.println("You hit a mine");
System.out.println("Game over.");
System.exit(0);
}
}