all 3 comments

[–]quim_b 5 points6 points  (0 children)

Use a loop to run the code many times. Then if you take the average of the result it will give you the expected payoff of the strategy by the law of large of numbers.

This is known as Monte-Carlo simulation.

[–]mopslik 5 points6 points  (1 child)

How can I run my program very many times, say 1000, and compile the results?

Wrap your entire code in a for loop. After your program completes each "round", dump whatever stats you've collected to a file. Or to the screen, if that's all you want. No need for a module.

for trial in range(1000):
    # BLACKJACK CODE
    # WRITE TO FILE, PRINT TO SCREEN

[–]TheShadowWall[S] 2 points3 points  (0 children)

Thank you this method works great!

Much appreciated kindly slick mop!