Hello I have tried to finish this python skeleton my professor gave and am having trouble doing so here is what I have so far
from random import randint import string #The a variable stores the string representations for printing the dice #You do not need to change any of this unless you want to make better looking #ASCII art dice. a=['','','','','',''] a[0] =' _____ \n' a[0]+='| |\n' a[0]+='| * |\n' a[0]+='|_____|\n' a[1] =' _____ \n' a[1]+='| |\n' a[1]+='| * * |\n' a[1]+='|_____|\n' a[2] =' _____ \n' a[2]+='| *|\n' a[2]+='| * |\n' a[2]+='|*____|\n' a[3] =' _____ \n' a[3]+='| * * |\n' a[3]+='| |\n' a[3]+='|_*_*_|\n' a[4] =' _____ \n' a[4]+='| * * |\n' a[4]+='| * |\n' a[4]+='|_*_*_|\n' a[5] =' _____ \n' a[5]+='| * * |\n' a[5]+='| * * |\n' a[5]+='|_*_*_|\n' # The following 3 print methods also do not need to change unless you want # to have different messages or graphics. def printIntro(): print '\n' print '***********************************************' print '***********************************************' print '** _ _ _ _ _ _ _ _ _ _ **' print '** C | | | | **' print '** R | * * | | * | **' print '** A | | | * | **' print '** P | * * | | * | **' print '** S |_ _ _ _ _ | |_ _ _ _ _ | **' print '** **' print '***********************************************' print '***********************************************' print '\n' def printRules(): print '' print 'Here are the rules for this version of Craps.' print ' (1) You start with $100, and you make your first bet.' print ' (2) On your first roll, you win if you roll 7 or 11.' print ' You lose if you roll 2,3, or 12. If you roll anything else,' print ' that becomes the \'point\'' print ' (3) You continue to roll until 1 of two things happens: ' print ' (A) You roll the point again. In this case, you win.' print ' (B) You roll a 7. In this case, you lose.' print ' (4) You may continue to play or quit the game. ' print '' #This method will only change if you decide to add extra options. def printOptions(): print '' print '(1) Play Craps!' print '(2) Print Rules' print '(3) Quit' print '' def printDice(d1,d2): #declare the global variable a so that you can access the ASCII art dice #print the image for dice one (d1). Note that the a variable is a list of strings. #If the number passed to d1 is the value of the roll, think about where the string #representation for that is in the list. That is, what element of the list stores #the picture for a roll of 2? a roll of 6? #print the image for dice two (d2) def rollDie(): #generate a random number between 1 and 6 (inclusive) and return it die1= randint(1,6) die2= randint(1,6) return die1, die2 def makeBet(amt): #get bet amount from user -- don't forget to store it in a variable! shooters_bet= input("The amount you would like to bet?") #error detection loop -- make sure that they enter a number between 1 # and how much many they passed in. Remember that the parameter amt # stores how much money the player has. If player enters bad number # print an informative message and get the bet amount again #return the bet amount return shooters_bet def playRound(amt): #Get bet amount by calling makeBet(). Pass it the amt that was passed #to this method (so it knows whether he/she is betting more than they #have. Store what it returns in a variable. #Have user hit enter key to roll dice raw_input("Hit ENTER to roll the dice...") firstTry= rollDie() print firstTry if firstTry == 7 or firstTry == 11 : print "You rolled a", diceTotal print "You Win what a Natural!" elif firstTry==2 or firstTry==3 or firstTry==12: print "You rolled a", diceTotal print "You Lose: Crap-Out!" else: i=rollDie() print i while i !=firstTry: if i == 7: print "you lose" break else: i=rollDie() if i == firstTry: print "you win" playRound() #Roll dice 1 #Roll dice 2 #print the dice by calling printDice, passing it the first and second die values #add the values and store in a 'point' variable #Tell user what they rolled (the number value) #This variable should stay here -- later on remember that it is called roll. roll=-1 #if the point is 7 or 11, the player wins! Print win message and #return the bet amount so it can be added to the player's money #if the point is 2,3, or 12, the player loses. Print lose message #and return the negative bet amount so it can be subtracted from #player's money #Enter the second phase of round -- if they didn't roll 2,3,7,11, or 12 # then the point has been set. #Print the point value #Loop while the roll equals neither the point nor 7 #Use the roll variable here to compare to point and to 7 #Get user to hit enter to roll #Roll dice 1 #Roll dice 2 #print the dice by calling printDice #store sum of two dice rolls in variable called roll #Tell user number value of what they rolled #out of the loop so the user finally either rolled 7 or the point #if they rolled the point, print win message and return bet amount #else print loss message and return negative bet amount #You can leave this function alone unless you want to add #additional functionality. This is the main driver function #that controls the game at the highest level. def main(): #Leave these four lines here play = 2 #set play option to 2 (print rules) money = 100 #initialize player money to 100 printIntro() #Print intro screen #leave this loop structure unless you add more options while money > 0 and play != 3 : #print the options printOptions() #get input from user to determine what they want to do play = int(input('What would you like to do? ')) #enter error detection loop to ensure user enters value #between 1 and 3 while play < 1 or play > 3: play = int(input('Invalid input. Choose 1,2, or 3')) #if they want to play, call playRound, passing the current balance if play==1: money += playRound(money) print 'You now have $',money #else if player selects 2, print the rules elif play==2: printRules() #Out of loop, game over. Print balance and departing message. print 'You are leaving the table with $',money if money < 100: print 'Too bad, so sad -- better luck next time' else: 'Where you goin\' with my money??' #Call main function (driver) main()