I am pretty new to Java, so i'm just trying some stuff out..
I am trying to figure out, how to check how many rolls it will take to get 6 sixes. (Yahtzee)
I've tried to use the &&, but it doesn't let me check for all 6 dices, it just stops when it hits the first 6'er.
I have tried something like this, but it didn't work out..
while (die.getDie1() != 6 && die.getDie2() != 6 && die.getDie3() != 6 && die.getDie4() != 6
&& die.getDie5() != 6 && die.getDie6() != 6) {
die.roll(6);
}
System.out.println("It took " + die.getCount() + " rolls to get a yahtzee!");
Can anyone help with a solution?
Aucun commentaire:
Enregistrer un commentaire