Learn (and play) Blackjack
bj.c
 
Several years ago I wrote a program to play and tutor Blackjack. It doesn't have a GUI so it is not as fancy as some of the current implementations.
 
Because it is run from a command line it can easily be run in a variety of different modes including an automatic mode which can be used to test a particular strategy.
 
The program uses a strategy to determine its moves and to calculate what the "correct" move should be for you.
 
By default it uses a modified version of Ken Uston's blackjack strategy when determining its own moves. There are other built-in strategies and it is also possible for you to display your own. Believe it or not, I originally wrote this program in the Mumps language, which is not at all suitable for this kind of programming.
 
During one vacation I translated it to C. Besides playing blackjack with it I also use the source code as a test bed for writing code that will compile on a variety of operating systems without modification. One interesting problem to solve was to determine how to get input from the keyboard without waiting for the user to type <ENTER>. This seems to be done differently on each operating system.
 
I put most of the documentation inside the program. It can be retrieved by building the program and typing bj -h. I've included that documentation here.
 
There are a variety of command line options used to implement the different modes of play. They can also be found by typing bj -h.
 
At the end of the game a summary of the results is displayed.
 
While designing this web page I played an example game. The results are reproduced here.
 
By default the program uses a modified version of Ken Uston's blackjack strategy when determining its own moves. There are other built-in strategies and it is also possible for you to display your own (see the bj -h output).
Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 14 of 485)
 
Comments, flames, broken links?
Please send email to maintainer@intricate-simplicity.com