This is a simulation of the card game of Blackjack or 21, Las Vegas style. This rather comprehensive version allows for up to seven players. On each hand each player may get another card (a hit), stand, split a hand in the event two identical cards were received, or double down. Also, the dealer will ask for an insurance bet if he has an exposed ace.
Cards are automatically reshuffled as the 51st card is reached. For greater realism, you may wish to change this to the 41st card by changing the 51 to 41 in this code:
If C<51 Then Goto LN230 EndIf
Actually, fanatical purists will want to modify the program so it uses three decks of cards instead of just one.
This program originally surfaced at Digital Equipment Corp.; the author is unknown.
Code Listing (Small Basic File: blackjck.sb):
This chapter is adapted from the book Basic Computer Games Small Basic Edition published by BibleByte Books.
To purchase this book in its entirety, please see the Computer Science For Kids web site.
Sample Run:
Next Chapter > >
© Copyright 2010 By BibleByte Books. All Rights Reserved. BibleByte Books, the BibleByte Books Logo, Computer Science For Kids, the Computer Science For Kids logo, and related trade dress are trademarks or registered trademarks of BibleByte Books.