#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0

    Unfair Chance - Python 3.2.3 - Game


    I made a little text based game. Let me know what you think. A reply with your score and any issues you have would be greatly appreciated

    Code:
    #Timothy Varela
    #December 5 - December 6
    #Unfair Chance
    
    import random
    
    print("Welcome to the 'Unfair Chance'.\nGood luck...\n")
    print()
    print("***NOTE: Please answer 'Yes or No' questions in the way they are spelt***")
    print("***NOTE: If you don't spell things right, the game will not work correctly.***\n")
    location = ("spaceship.", "lions den.", "girls bathroom.", "grassy meadow.", "sewer.", "cave.", "forrest.", "banquet hall")
    print("You awaken, you find yourself in a", random.choice(location))
    print("You see a strange figure move in the distance.\n")
    
    stranger = ('Spock', 'Lorean', 'Sarek', 'Tuvok', 'Watto', 'Batman', 'Boko', 'George')
    strangername = random.choice(stranger)
    print('"My name is ' +strangername+ '", the man says.')
    print(strangername,'walks up to you and asks, "Would you like to play a game?"')
    
    play = input("Yes or No? ")
    if play == "Yes":
        print('"What kinda game you ask? Well this' " isn't " 'for the faint of heart."\n')
    elif play == "yes":
        print('"What kinda game you ask? Well this' " isn't " 'for the faint of heart."\n')
    else:
        input('"Well...' "that's " 'your loss. See ya around."')
        quit()
    
    name = input('"Heh,'" you're "'brave.'" What's "'your name chump?"\n')
    str(print('"Well hello there', name, 'lets play."\n'))
    print('"Say... you' " don't " 'happen to have any money on you, do you?"')
    bills = random.randint(500,2000)
    money = bills
    originalmoney = money
    print("You look in your pocket and to your surprise, you find", money,"dollars.")
    print()
    print("***You need to get four 3's in three rounds to win***")
    print()
    bet = int(input("Place a bet and test your luck...\nYour wager: "))
    if bet == money:
            print("Wow! You've risked it all!")
    while bet > money:
        bet = int(input("You don't have that much, bet again: "))
    while bet < 1:
        bet = int(input("You must bet more than 1 dollar, bet again: "))
        
    money = money - bet
    randomint = random.randint(1,5)
    badguy = 4
    randomint = random.randint(1,5)
    input("Press 'Enter' to roll the die.\n")
    print("Round 1")                                                        #R1
    if randomint == 3:
        print("You rolled a", randomint)
        badguy = badguy -1
    else:
        print("You rolled a", randomint)
        badguy = badguy -0
    randomint = random.randint(1,5)
    if randomint == 3:
        print("You rolled a", randomint)
        badguy = badguy -1
    else:
        print("You rolled a", randomint)
        badguy = badguy -0
    randomint = random.randint(1,5)
    if randomint == 3:
        print("You rolled a", randomint)
        badguy = badguy -1
    else:
        print("You rolled a", randomint)
        badguy = badguy -0
    randomint = random.randint(1,5)
    if randomint == 3:
        print("You rolled a", randomint)
        badguy = badguy -1
    else:
        print("You rolled a", randomint)
        badguy = badguy -0
    if badguy >= 0:
        print(badguy, "left...\n")
        input("Press 'Enter' to roll again.\n")
        print("Round 2")                                                #R2
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        print(badguy, "left...\n")
        if badguy >= 0:
            input("Press 'Enter' to roll again.\n")
            print("Round 3")                                                    #R3
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            print(badguy, "left...")
    if badguy <= 0:
        money = money + bet + bet
    else:
        money = money - bet + bet
    if money == 1:
        print(money, "dollar is in your account. That's sad...\n")
    elif money == 0:
        print(money, "dollars are in your account.\n")
    elif money > originalmoney:
        print(money, "dollars are in your account. Wow, your total is",money,"dollars, a",(money - originalmoney),"dollar profit.")
    elif money < originalmoney:
        print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
    if money <= 0:
        input("It seems like you've run out of money. Sorry", name, "\n")
        quit()
    
    again = input("Play again? Yes or No? ")                               #Second Game
    if again == "Yes":
        if money == 1:
            print("You have", money, "dollar left.")
        else:
            print("You have", money, "dollars left.")
        bet = int(input("Place your wager: "))
        if bet == money:
            print("Wow! You've risked it all!")
        while bet > money:
            bet = int(input("You don't have that much, bet again: "))
        while bet < 1:
            bet = int(input("You must bet more than 1 dollar, bet again: "))
        money = money - bet
        randomint = random.randint(1,5)
        badguy = 4
        randomint = random.randint(1,5)
        input("Press 'Enter' to roll the die.\n")
        print("Round 1")                                                        #R1
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        if badguy >= 0:
            print(badguy, "left...\n")
            input("Press 'Enter' to roll again.\n")
            print("Round 2")                                                #R2
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            print(badguy, "left...\n")
            if badguy >= 0:
                input("Press 'Enter' to roll again.\n")
                print("Round 3")                                                    #R3
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                print(badguy, "left...")
        if badguy <= 0:
            money = money + bet + bet
        else:
            money = money - bet + bet
        if money == 1:
            print(money, "dollar is in your account. That's sad...\n")
        elif money == 0:
            print(money, "dollars are in your account.\n")
        elif money > originalmoney:
            print(money, "dollars are in your account. Wow, your total is",money,", a",money - originalmoney,"dollar profit.")
        elif money < originalmoney:
            print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
        if money <= 0:
            input("It seems like you've run out of money. Sorry", name, "\n")
            quit()
    else:
        input("I guess you've had enough for now, see ya around.")
        quit()
    
    again = input("Play again? Yes or No? ")                               #Third Game
    if again == "Yes":
        if money == 1:
            print("You have", money, "dollar left.")
        else:
            print("You have", money, "dollars left.")
        bet = int(input("Place your wager: "))
        if bet == money:
            print("Wow! You've risked it all!")
        while bet > money:
            bet = int(input("You don't have that much, bet again: "))
        while bet < 1:
            bet = int(input("You must bet more than 1 dollar, bet again: "))
        money = money - bet
        randomint = random.randint(1,5)
        badguy = 4
        randomint = random.randint(1,5)
        input("Press 'Enter' to roll the die.\n")
        print("Round 1")                                                        #R1
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        randomint = random.randint(1,5)
        if randomint == 3:
            print("You rolled a", randomint)
            badguy = badguy -1
        else:
            print("You rolled a", randomint)
            badguy = badguy -0
        if badguy >= 0:
            print(badguy, "left...\n")
            input("Press 'Enter' to roll again.\n")
            print("Round 2")                                                #R2
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            randomint = random.randint(1,5)
            if randomint == 3:
                print("You rolled a", randomint)
                badguy = badguy -1
            else:
                print("You rolled a", randomint)
                badguy = badguy -0
            print(badguy, "left...\n")
            if badguy >= 0:
                input("Press 'Enter' to roll again.\n")
                print("Round 3")                                                    #R3
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                randomint = random.randint(1,5)
                if randomint == 3:
                    print("You rolled a", randomint)
                    badguy = badguy -1
                else:
                    print("You rolled a", randomint)
                    badguy = badguy -0
                print(badguy, "left...")
        if badguy <= 0:
            money = money + bet + bet
        else:
            money = money - bet + bet
        if money == 1:
            print(money, "dollar is in your account. That's sad...\n")
        elif money == 0:
            print(money, "dollars are in your account.\n")
        elif money > originalmoney:
            print(money, "dollars are in your account. Wow, your total is",money,", a",money - originalmoney,"dollar profit.")
        elif money < originalmoney:
            print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
        if money <= 0:
            print("It seems like you've run out of money. Sorry", name, "\n")
    else:
        input("I guess you've had enough for now, see ya around.")
        quit()
        
    dbl = input("Double or nothing? (Yes or No) ")                                  #Double or nothing section
    print("You have", money,"dollars.")
    if dbl == "Yes":
        bet = int(input("Place your wager: "))
        if bet == money:
            print("Wow! You've risked it all!")
        while bet > money:
            bet = int(input("You don't have that much, bet again: "))
        while bet < 1:
            bet = int(input("You must bet more than 1 dollar, bet again: "))
        input('"Haha okay then."\n"I\'ll be playing this round."\n"It\'s going to be a little different."\n')
        input("***This time he needs to roll a 3, but the odds are much higher.***\n")
        money = money - bet
        nbadguy = 8
        onbadguy = nbadguy
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        print('\n"I have',nbadguy, '3\'s left."\n')
        input()
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        print('\n"I have',nbadguy, '3\'s left."\n')
        input()
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        randomint = random.randint(1,3)
        if randomint == 3:
            print("I rolled a", randomint)
            nbadguy = nbadguy -1
        else:
            print("I rolled a", randomint)
            nbadguy = nbadguy -0
        print('"I ended up with',onbadguy - nbadguy, '3\'s"\n')
        if nbadguy <= 0:
            if money - bet*2 <=0:
                print('"I win!! Ha!! You have', money, 'dollars."')
            elif money < originalmoney:
                money = money - bet
                print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
            else:
                money = money - bet*2
                print('"I win!! Ha!! You have"', money)
        else:
            money = money + bet + bet + bet
            print('"Dang it, I\'ve lost! You have', money, 'dollars."')
            if money > originalmoney:
                print(money, "dollars are in your account. Your total is",money,", a",money - originalmoney,"dollar profit.")
            elif money < originalmoney:
                print(money, "dollars are in your account. You've lost", originalmoney - money, "dollars.\n")
            else:
                print("Looks like you've broken even.")
    else:
        input("I guess you've had enough for now, see ya around.")
        quit()
    
    input("\n\nPress any key to exit.")
    Last edited by jimmbobb22; December 9th, 2012 at 08:37 PM. Reason: I didn't indent
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2005
    Location
    U.S A.Z.
    Posts
    24
    Rep Power
    0
    What version of python is this? When I try to run it in python 2.7.3 I get an error on line 30
    Code:
     File "unfairchance.py", line 30
        str(print('"Well hello there', name, 'lets play."\n'))
    Then I fix that and try to answer the first question and no matter what I enter I get another error
    Code:
    ***NOTE: Please answer 'Yes or No' questions in the way they are spelt***
    ***NOTE: If you don't spell things right, the game will not work correctly.***
    
    ('You awaken, you find yourself in a', 'lions den.')
    You see a strange figure move in the distance.
    
    "My name is Batman", the man says.
    ('Batman', 'walks up to you and asks, "Would you like to play a game?"')
    Yes or No? Yes
    Traceback (most recent call last):
      File "unfairchance.py", line 20, in <module>
        play = input("Yes or No? ")
      File "<string>", line 1, in <module>
    NameError: name 'Yes' is not defined
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    It's 3.2.3
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2005
    Location
    U.S A.Z.
    Posts
    24
    Rep Power
    0
    Ok now it works great running it in python 3.2. I ran it several times and didn't get any errors.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    Sweet!! Did you like it?
  10. #6
  11. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,894
    Rep Power
    481
    Please refactor your program. For example
    Code:
    if randomint == 3:
        print("You rolled a", randomint)
        badguy = badguy -1
    else:
        print("You rolled a", randomint)
        badguy = badguy -0
    always evaluates the statement

    print("You rolled a", randomint)

    The code should be
    Code:
    print("You rolled a", randomint)
    if randomint == 3:
        badguy = badguy -1
    else:
        badguy = badguy -0
    (I'd compress the code quite a lot more than that. This is enough lesson for now.
    (badguy -= 3 == randomint))
    [code]Code tags[/code] are essential for python code and Makefiles!
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by b49P23TIvg
    (I'd compress the code quite a lot more than that. This is enough lesson for now.
    (badguy -= 3 == randomint))
    Code:
    randomint = random.randint(1,5)
    badguy-=3 == randomint
    print("You rolled a", randomint)
    I tried this, and it works! It will cut my code length in half!!
    Thank you very much for your input. I know it's super long. I know the actual game play is pretty short, but did you like it?
  14. #8
  15. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,894
    Rep Power
    481
    I didn't play it. Looks like one of the games from the tavern in devshed green dragon game.
    [code]Code tags[/code] are essential for python code and Makefiles!
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by b49P23TIvg
    I didn't play it. Looks like one of the games from the tavern in devshed green dragon game.
    Oh, haha :P
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    6
    Rep Power
    0
    I made changes, its much much shorter now.

    Code:
    #Timothy Varela
    #December 5 - December 6
    #Unfair Chance
    
    import random
    
    print("Welcome to the 'Unfair Chance'.\nGood luck...\n")
    print()
    print("***NOTE: Please answer 'Yes or No' questions in the way they are spelt***")
    print("***NOTE: If you don't spell things right, the game will not work correctly.***\n")
    location = ("spaceship.", "lions den.", "girls bathroom.", "grassy meadow.", "sewer.", "cave.", "forrest.", "banquet hall")
    print("You awaken, you find yourself in a", random.choice(location))
    print("You see a strange figure move in the distance.\n")
    
    stranger = ('Spock', 'Lorean', 'Sarek', 'Tuvok', 'Watto', 'Batman', 'Boko', 'George')
    strangername = random.choice(stranger)
    print('"My name is ' +strangername+ '", the man says.')
    print(strangername,'walks up to you and asks, "Would you like to play a game?"')
    
    play = input("Yes or No? ")
    if play == "Yes":
        print('"What kinda game you ask? Well this' " isn't " 'for the faint of heart."\n')
    elif play == "yes":
        print('"What kinda game you ask? Well this' " isn't " 'for the faint of heart."\n')
    else:
        input('"Well...' "that's " 'your loss. See ya around."')
        quit()
    
    name = input('"Heh,'" you're "'brave.'" What's "'your name chump?"\n')
    str(print('"Well hello there', name, 'lets play."\n'))
    print('"Say... you' " don't " 'happen to have any money on you, do you?"')
    bills = random.randint(500,2000)
    money = bills
    originalmoney = money
    print("You look in your pocket and to your surprise, you find", money,"dollars.")
    print()
    print("***You need to get four 3's in three rounds to win***")
    print()
    bet = int(input("Place a bet and test your luck...\nYour wager: "))
    if bet == money:
            print("Wow! You've risked it all!")
    while bet > money:
        bet = int(input("You don't have that much, bet again: "))
    while bet < 1:
        bet = int(input("You must bet more than 1 dollar, bet again: "))
        
    money = money - bet
    badguy = 4
    input("Press 'Enter' to roll the die.\n")
    print("Round 1")                                                        #R1
    
    randomint = random.randint(1,5)
    badguy-=3 == randomint
    print("You rolled a", randomint)
    randomint = random.randint(1,5)
    badguy-=3 == randomint
    print("You rolled a", randomint)
    randomint = random.randint(1,5)
    badguy-=3 == randomint
    print("You rolled a", randomint)
    randomint = random.randint(1,5)
    badguy-=3 == randomint
    print("You rolled a", randomint)
    if badguy >= 0:
        print(badguy, "left...\n")
        input("Press 'Enter' to roll again.\n")
        print("Round 2")                                                #R2
        randomint = random.randint(1,5)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        print(badguy, "left...\n")
        if badguy >= 0:
            input("Press 'Enter' to roll again.\n")
            print("Round 3")                                                    #R3
            randomint = random.randint(1,5)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            print(badguy, "left...")
    if badguy <= 0:
        money = money + bet + bet
    else:
        money = money - bet + bet
    if money == 1:
        print(money, "dollar is in your account. That's sad...\n")
    elif money == 0:
        print(money, "dollars are in your account.\n")
    elif money > originalmoney:
        print(money, "dollars are in your account. Wow, your total is",money,"dollars, a",(money - originalmoney),"dollar profit.")
    elif money < originalmoney:
        print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
    if money <= 0:
        input("It seems like you've run out of money. Sorry", name, "\n")
        quit()
    
    again = input("Play again? Yes or No? ")                               #Second Game
    if again == "Yes":
        if money == 1:
            print("You have", money, "dollar left.")
        else:
            print("You have", money, "dollars left.")
        bet = int(input("Place your wager: "))
        if bet == money:
            print("Wow! You've risked it all!")
        while bet > money:
            bet = int(input("You don't have that much, bet again: "))
        while bet < 1:
            bet = int(input("You must bet more than 1 dollar, bet again: "))
        money = money - bet
        randomint = random.randint(1,5)
        badguy = 4
        randomint = random.randint(1,5)
        input("Press 'Enter' to roll the die.\n")
        print("Round 1")                                                        #R1
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        if badguy >= 0:
            print(badguy, "left...\n")
            input("Press 'Enter' to roll again.\n")
            print("Round 2")                                                #R2
            randomint = random.randint(1,5)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            print(badguy, "left...\n")
            if badguy >= 0:
                input("Press 'Enter' to roll again.\n")
                print("Round 3")                                                    #R3
                randomint = random.randint(1,5)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                print(badguy, "left...")
        if badguy <= 0:
            money = money + bet + bet
        else:
            money = money - bet + bet
        if money == 1:
            print(money, "dollar is in your account. That's sad...\n")
        elif money == 0:
            print(money, "dollars are in your account.\n")
        elif money > originalmoney:
            print(money, "dollars are in your account. Wow, your total is",money,", a",money - originalmoney,"dollar profit.")
        elif money < originalmoney:
            print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
        if money <= 0:
            input("It seems like you've run out of money. Sorry", name, "\n")
            quit()
    else:
        input("I guess you've had enough for now, see ya around.")
        quit()
    
    again = input("Play again? Yes or No? ")                               #Third Game
    if again == "Yes":
        if money == 1:
            print("You have", money, "dollar left.")
        else:
            print("You have", money, "dollars left.")
        bet = int(input("Place your wager: "))
        if bet == money:
            print("Wow! You've risked it all!")
        while bet > money:
            bet = int(input("You don't have that much, bet again: "))
        while bet < 1:
            bet = int(input("You must bet more than 1 dollar, bet again: "))
        money = money - bet
        randomint = random.randint(1,5)
        badguy = 4
        randomint = random.randint(1,5)
        input("Press 'Enter' to roll the die.\n")
        print("Round 1")                                                        #R1
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
        if badguy >= 0:
            print(badguy, "left...\n")
            input("Press 'Enter' to roll again.\n")
            print("Round 2")                                                #R2
            randomint = random.randint(1,5)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            randomint = random.randint(1,5)
            badguy-=3 == randomint
            print("You rolled a", randomint)
            print(badguy, "left...\n")
            if badguy >= 0:
                input("Press 'Enter' to roll again.\n")
                print("Round 3")                                                    #R3
                randomint = random.randint(1,5)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                randomint = random.randint(1,5)
                badguy-=3 == randomint
                print("You rolled a", randomint)
                print(badguy, "left...")
        if badguy <= 0:
            money = money + bet + bet
        else:
            money = money - bet + bet
        if money == 1:
            print(money, "dollar is in your account. That's sad...\n")
        elif money == 0:
            print(money, "dollars are in your account.\n")
        elif money > originalmoney:
            print(money, "dollars are in your account. Wow, your total is",money,", a",money - originalmoney,"dollar profit.")
        elif money < originalmoney:
            print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
        if money <= 0:
            print("It seems like you've run out of money. Sorry", name, "\n")
    else:
        input("I guess you've had enough for now, see ya around.")
        quit()
        
    dbl = input("Double or nothing? (Yes or No) ")                                  #Double or nothing section
    print("You have", money,"dollars.")
    if dbl == "Yes":
        bet = int(input("Place your wager: "))
        if bet == money:
            print("Wow! You've risked it all!")
        while bet > money:
            bet = int(input("You don't have that much, bet again: "))
        while bet < 1:
            bet = int(input("You must bet more than 1 dollar, bet again: "))
        input('"Haha okay then."\n"I\'ll be playing this round."\n"It\'s going to be a little different."\n')
        input("***This time he needs to roll a 3, but the odds are much higher.***\n")
        money = money - bet
        nbadguy = 8
        onbadguy = nbadguy
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        print('\n"I have',nbadguy, '3\'s left."\n')
        input()
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        print('\n"I have',nbadguy, '3\'s left."\n')
        input()
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        randomint = random.randint(1,3)
        nbadguy -= 3 == randomint
        print("I rolled a", randomint)
        print('"I ended up with',onbadguy - nbadguy, '3\'s"\n')
        if nbadguy <= 0:
            if money - bet*2 <=0:
                print('"I win!! Ha!! You have', money, 'dollars."')
            elif money < originalmoney:
                money = money - bet
                print(money, "dollars are in your account. You've lost", originalmoney - money, "so far...\n")
            else:
                money = money - (bet*2)
                print('"I win!! Ha!! You have"', money)
        else:
            money = money + bet + bet + bet
            print('"Dang it, I\'ve lost! You have', money, 'dollars."')
            if money > originalmoney:
                print(money, "dollars are in your account. Your total is",money,"dollars, a",money - originalmoney,"dollar profit.")
            elif money < originalmoney:
                print(money, "dollars are in your account. You've lost", originalmoney - money, "dollars.\n")
            else:
                print("Looks like you've broken even.")
    else:
        input("I guess you've had enough for now, see ya around.")
        quit()
    
    input("\n\nPress any key to exit.")
  20. #11
  21. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,894
    Rep Power
    481
    Code:
    for i in 'abcd':
        randomint = random.randint(1,5)
        badguy-=3 == randomint
        print("You rolled a", randomint)
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo