Craps (Due 24 Feb 2017)

In this assignment you will calculate the probability of winning at Craps in a casino with a pair of fair dice. Here are the rules for Craps.

You will simulate the throw of a die using random.randint (1, 6). The structure of the program will be as follows:

import random

# simulate a single round of craps and
# return 1 if player wins and 0 if he loses
def craps ():
  # write the body of the code

def main():
  # prompt the user to enter the number of rounds
  num_rounds = int (input ("Enter number of rounds: "))

  # compute the number of times he wins 
  num_wins = 0
  for n in range (num_rounds):
    num_wins += craps()

  # print the result
  print ("Player wins", num_wins, "out of", num_rounds, "rounds.")

main()

The program that you will be writing will be called Craps.py. We will be looking at good documentation, design, and adherence to the coding convention as discussed in class. Your file Craps.py will have the following header:

#  File: Craps.py

#  Description:

#  Student Name:

#  Student UT EID:

#  Course Name: CS 303E

#  Unique Number: 

#  Date Created:

#  Date Last Modified:

Use the Canvas program to submit your Craps.py file. We should receive your work by 11 PM on Friday, 24 Feb 2017. There will be substantial penalties if you do not adhere to the guidelines.

References