
please wait
|
|
if (roll1 || roll2 == 1)
and else if (roll1 && roll2 == 1)
are the problem. The ||
and &&
cannot join together two objects to test their equality against one. They join together two different boolean expressions so in line 93 the program evaluates roll1 as its own boolean expression. And since the dice can never be zero it immediately evaluates to true so the code will always run as if the players rolled a one; therefore, the program continues to set the score to zero so it needs to switch turns then roll again but since that roll will also evaluate to true this continue to repeats ad infitum.