[Tutor] blackjack game

Lie Ryan lie.1296 at gmail.com
Thu Apr 29 23:16:28 CEST 2010


On 04/30/10 06:23, Shurui Liu (Aaron Liu) wrote:
> # Blackjack
> # From 1 to 7 players compete against a dealer
<snip code>
> 
> 
> Here is the code of this game. I want to change some part of them.
> 1. Since I don't know what part of code is "responsible" for the
> number of cards, so I don't know how to add a "card number check"
> attribute, I mean, to check the number of card is more enough for next
> time play no matter how many players there are, if cards are not more
> enough, print out a notice and stop the program;

The BJ_Game is responsible in querying the Deck if it has enough cards
for the round. BJ_Game will calculate the number of players and asks if
ask BJ_Deck if it can support that much player. Be careful when
calculating number of cards since in blackjack using one deck it is
possible to split one's hand into four (btw, why is BJ_Player inheriting
BJ_Deck? that would make splitting impossible; a player has a hand but
it is not a hand :-)

> 2. I am not sure if I can let the winner get all of the cards and
> print out what cards the winner has when the game finished.

that depends on the house rule, I think, some games requires all player
can see everyone else's card while other games keeps everyone's hand closed.



More information about the Tutor mailing list