私のブラックジャックプログラムには次のものがあります:
Card c = dealCard(deck); //deals the card
updatePoints(players[i], c); // calls updatePoints below.
updatePoints 関数は次のようになります。
public static void updatePoints(Player player, Card c){
int point = c.getValue();
if(player.getPoints() + point >21 && (player.ace1 == 11 || player.ace2 == 11 || player.ace3 == 11 || player.ace4 == 11)){
player.points -= 10;
player.setPoints(point);
if (player.ace1 == 11){
player.ace1 = 1;
}else if(player.ace2 == 11){
player.ace2 = 1;
}else if(player.ace3 == 11){
player.ace3 = 1;
}else if (player.ace4 == 11){
player.ace4 = 1;
}
}
if (point == 1){
//default value for player.ace1 .. player.ace4 is 0
if(player.ace1 == 0){
player.ace1 = 11;
player.setPoints(11);
}else if (player.ace2 == 0){
player.ace2 = 11;
player.setPoints(11);
}else if (player.ace3 == 0){
player.ace3 = 11;
player.setPoints(11);
}else if(player.ace4 == 0){
player.ace4 = 11;
player.setPoints(11);
}
}else{
player.setPoints(point);
}
return;
}
何らかの理由でポイントが 21 を超えても、エースの値は変更されず、エースは調整されません。どんな助けでも大歓迎です。ありがとうございました