9/8/03
It should take us forever and a day to write this program.
We are inheriting from existing player and game classes and creating blackjack specific subclasses. A blackjack player keeps track of his bankroll, player number and winning percentage. A player is constructed with a strategy as elected by the user. The dealer is the final player, using one of the sets of rules again elected by the user.
The strategies are simple. They are passed a hand history and store whatever portion of it they feel relevant, usually using a single integer. The player plays his hands according to the strategy. Hands are stored as a vector of vectors of cards representing each player's current cards. A deck class is in charge of dealing random cards, keeping track of which cards have been dealt and determining when the game is over.
The main function of blackjackgame has three loops. The external loop iterates until the game is over (cards have run out). The internal loops are independent of each other, iterating over the players twice. The first loop plays the hand and the second one scores it.
Back to
BlackjackDesign
There are no comments on this page. [Add comment]