Im having problems with my for loop. The user has 3 times to roll the number that was guessed. when the condition is met on the the third try I want it to say that they won not that they lose
for(int x = 0; x < 3 && hasWon == false; x++)
{
if(game1.getAnswer() == guess)
{
JOptionPane.showMessageDialog(null, guess + "and " + game1.getAnswer() + " You WIN!!");
hasWon = true;
}
else if(x == 3 && game1.getAnswer() != guess)
{
JOptionPane.showMessageDialog(null, "YOU lose!!");
}
else
{
game1.setDice1(roll1);
game1.setDice2(roll2);
JOptionPane.showMessageDialog(null, game1.toString());
}