please code in python What is the expected number of turns per solitaire game with a hold-at-20- or-goal play policy? Simulate a given number of solitaire Pig games where a player rolls until a 1 (“pig”) is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. Report the average number of turns per game. Input Enter a single positive integer indicating the number of games simulated. (Larger numbers will tend to yield better estimations.) Output •Initially, prompt the user with “Games?” •After the simulations, print “Average turns:” followed by the average turns taken per simulated game. 6.1 Sample Transcript Games? 1000000 Average turns: 12.634906
please code in python
What is the expected number of turns per solitaire game with a hold-at-20- or-goal play policy? Simulate a given number of solitaire Pig games where a player rolls until a 1 (“pig”) is rolled, or the turn total is greater than or equal to 20, or the score plus the turn total is greater than or equal to 100. Report the average number of turns per game. Input Enter a single positive integer indicating the number of games simulated. (Larger numbers will tend to yield better estimations.) Output •Initially, prompt the user with “Games?” •After the simulations, print “Average turns:” followed by the average turns taken per simulated game. 6.1 Sample Transcript Games? 1000000 Average turns: 12.634906
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images