因此,无论playerWins是否返回true或false,do-while循环都将继续。我正在努力做到这一点,这样如果球员赢了,比赛就结束了。我不知道我这辈子到底出了什么问题。我真的非常感谢所有的帮助/提示。非常感谢。
int credibility = INITIAL_CREDIBILITY_LEVEL;
displayIntro();
userName = IR4.getString("\n" + "What are you called in your city?");
for(counter = 1; counter <= NBR_OF_ROUNDS; counter ++)
{
do
{
if(counter == 1)
{
displayFirstRoundHeader(userName);
}
else
{
displayRoundHeader();
}
combination = IR4.getRandomNumber(STARTING_LOW, STARTING_HIGH);
System.err.println(combination);
playerWins = playRound(combination);
credibility -= CREDIBILITY_LOST;
if(playerWins)
System.out.println("Yay you win");
else if(credibility == 0)
{
displayRoundLossText(userName, credibility, combination);
displayLossText(userName);
}
else
displayRoundLossText(userName, credibility, combination);
}
while(!playerWins);