想起BlackJack遊戲...我創建了一種簡單計算的方法,無論計算機是否應該畫卡片,規則。我想讓這個更加「聰明」,因此即使對於創作者(我)來說也會讓遊戲變得更加難以預測。我希望我的經銷商在選擇何時在BlackJack遊戲中畫卡時更加「智能」
我可以在這裏添加什麼?如何讓我的經銷商在沒有硬編碼規則的情況下進行抽籤?
// Compute if computer should draw a hand or not depending on hand value of player.
// Also, computer may take higher risk if player has reached BLACKJACK.
private static Deck dealerDraw(Deck deck, Hand player, Hand player2, Hand dealer)
{
if(player.getHandTotal() <= BLACKJACK)
{
// Dealer takes a precaution and only draws
// if hand total is less than or equal to 15.
while(dealer.getHandTotal() <= 15 &&
(dealer.getHandTotal() <= player.getHandTotal() ||
dealer.getHandTotal() <= player2.getHandTotal()))
deck = drawFromDeck(deck, dealer);
// Player has reached BLACKJACK!
// There's no or little chance to win,
// dealer risks and draws even if total is high.
if (player.getHandTotal() == BLACKJACK ||
player2.getHandTotal() == BLACKJACK)
while(dealer.getHandTotal() < BLACKJACK &&
dealer.getHandTotal() != BLACKJACK)
deck = drawFromDeck(deck, dealer);
} // end if()
return deck;
} // dealerDraw()
這不是問題的答案,但我同意:) – 0xc0de
嗯,問題是「我能在這裏添加什麼?」我的答案是「不多」:--P –