在二十一点游戏中,我提示用户选择是否要加倍下注:
while(true){
if(players[i].doubledown == true){
break;
}
System.out.println("Want to double down?\n1)Yes\n2)No\n");
dd = IO.readInt();
if (dd != 1 && dd!= 2){
IO.reportBadInput();
}else{
break;
}
}
int x = 0;
if (dd!=1 && players[i].doubledown == false){
System.out.print("Choose your next move, " + players[i].name + ": \n" + "Points: " + players[i].points + "\n" + "Hint: ");
getHints(players[i]);
System.out.print( "\n1)Hit\n2)Stand\n");
System.out.println();
x = IO.readInt();
}else if(dd == 1 && players[i].doubledown == true){
x = 2;
}else if( dd== 1 && players[i].doubledown == false){
x = 1;
players[i].doubledown = true;
}
if(x ==2 || x ==1){
//
//Stand or Bust
//
}
出于某种原因,它一直要求我加倍下注,然后轮到玩家 2。为什么?任何帮助将不胜感激。