EE 289

Project 1
Due Sept. 23, 2010

  1. Example of the Monte Carlo method. Write a program to determine the optimal strategy for playing the following Blackjack hads: For each case, find the percent of hands won if the player stands and the percent of hands won if the player hits. Run ten simulations of 1,000,000 trials each for each of the four cases (hit a 9-7 when the dealer shows a 6, stand on 9-7 when the dealer shows a 6; do the same for when the dealer shows a 7). You can generate random numbers using the ranlib.c program:

    Random number library: ranlib.c. Modified slightly from the University of Texas ranlibc program by Brown and Lovato.

    Header file for random number library: ranlib.h

    Example program which uses random number generator from ranlib: find_pi.c. To compile:

     gcc -o find_pi find_pi.c ranlib.c -lm
    The C statement
     x = genunf(-1.0,1.0); 
    generates a random floating point number between -1.0 and +1.0.


Bill Rison, <rison@nmt.edu >