我不明白为什么我会得到这样的输出。每次我抽出初始牌时,输出都会尝试重新创建和重新洗牌,但为什么呢?因为我正在检查卡片组是否为空或为空,如果是,则正在创建它。
为什么我的代码不起作用?
输出:
######### BLACK ### JACK #########
deal, hit, stay, exit: deal
Creating deck...
Shuffling deck...
Drawing Player's card... A_♦
Creating deck...
Shuffling deck...
Drawing Dealer's card... X_X
Creating deck...
Shuffling deck...
Drawing Player's card... 6_♥
Creating deck...
Shuffling deck...
Drawing Dealer's card... X_X
Dealers Hand: A_♦ X_X = 11
Players Hand: 6_♥ A_♦ = 17
初始绘制方法:
private static Deck initialDraw(Deck deck, Hand player, Hand dealer)
{
drawFromDeck(deck, player);
drawFromDeck(deck, dealer);
drawFromDeck(deck, player);
drawFromDeck(deck, dealer);
System.out.print("\n");
showHands(player, dealer);
compareHands(player, dealer);
return deck;
}
当我使用以下代码时,我没有得到这个输出,它有什么不同?我仍在引用同一个数组并将其传回,不是吗?
private static Deck initialDraw(Deck deck, Hand player, Hand dealer)
{
deck = checkDeck(deck);
drawFromDeck(deck, player);
drawFromDeck(deck, dealer);
drawFromDeck(deck, player);
drawFromDeck(deck, dealer);
System.out.print("\n");
showHands(player, dealer);
compareHands(player, dealer);
return deck;
}