Think of BlackJack game... I created a method which does simple calculation whether computer should draw a card and just hard coded the rules. I would like to make this more 'intelligent' therefore making game a bit more unpredictable even for creator (me).
What could I add here? How to make my dealer draw without hard coding much of the rules?
// 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()