Talk about absolutely anything here!
  • User avatar
  • User avatar
  • User avatar

Am I insane?

Yes
47
77%
No
14
23%
#182999
For once, I actually have free time, so of course the server is down.

Anyway, I've been doing some basic Python programming. I made a little guessing game. Try it out and tell me what you think.
Spoiler:
Code: Select all
import random
from sys import exit

def levelChoose():
    global expertMode
    global guessMax
    expertMode = 0
    guessMax = 0
    levelConfirm = 0
    print("Welcome! Choose your difficulty: easy, medium, hard, or expert.\n")
    guessMax = 0
    while levelConfirm == 0:
        level = raw_input("")
        levelConfirm = 1
        if level.lower() == "easy":
            return 10
        elif level.lower() == "medium":
            return 100
        elif level.lower() == "hard" or level.lower() == "expert":
            if level.lower() == "expert":
                guessMax = 10
                expertMode = 1
            return 1000
        else:
            print("Please pick one of the indicated options.\n")
            levelConfirm = 0

def play(max):
    global expertMode
    global guessMax
    global guessNumber
    global playAgain
    guessNumber = 0
    answer = random.randint(0, max)
    while True:
        if expertMode == 1:
            guessLine = "(inclusive). You have " + str(guessMax - guessNumber) + " guesses remaining"
        else:
            guessLine = "(inclusive)"
        guessNumber+= 1
        guess = raw_input("Guess a number from 0 to %d %s." % (max, guessLine))
        guess = int(guess)
        if guess == answer:
            playAgain = raw_input("You won! It took %d guesses. Play again? Y/N\n" % guessNumber)
            if playAgain.lower() == "y":
                print("\n")
                return True
            elif playAgain.lower() == "n":
                print("Goodbye.\n")
                return False
        else:
            if guessNumber == guessMax:
                playAgain = raw_input("You lose! Play again? Y/N\n")
                if playAgain == "y":
                    print("\n")
                    return True
                elif playAgain == "n":
                    print("Goodbye.\n")
                    exit(0)
            if guess < answer:
                lowHigh = "low"
            elif guess > answer:
                lowHigh = "high"
            print("Nope, too %s. Try again: %d guesses and counting.\n" % (lowHigh, guessNumber))

while play(levelChoose()): pass
~dlgn
#183534
Image

Notch as a parasprite. By MCForums' inawordnope.
#183535
dlgn wrote:Image

Notch as a parasprite. By MCForums' inawordnope.
If you get bitten by a 'Notchsquito' do you get world edit powers?
#183547
Eetrab wrote:
dlgn wrote:Image

Notch as a parasprite. By MCForums' inawordnope.
If you get bitten by a 'Notchsquito' do you get world edit powers?
That's a parasprite. The worst you can expect is that it begins feeding on organic material and multiplying at disconcerting rates, eventually becoming capable of consuming everything.
#183602
Skylord_Fox wrote:
Eetrab wrote:
dlgn wrote:*snip*[/img]

Notch as a parasprite. By MCForums' inawordnope.
If you get bitten by a 'Notchsquito' do you get world edit powers?
That's a parasprite. The worst you can expect is that it begins feeding on organic material and multiplying at disconcerting rates, eventually becoming capable of consuming everything.
He'll eat all your trees and sand!
#183876
Skylord_Fox wrote:He's still the best in my hearts.
[youtube]K3GMkWfpj4s[/youtube]
I always loved Ten, but Eleven was my favorite until he started becoming really sexist. Moffat can go <anatomically impossible>.

In regard to a completely different TV show, specifically Game of Thrones, those of you who didn't read the books really missed out when it came to the White Walkers, because this is what they're supposed to look like.

Image
  • 1
  • 24
  • 25
  • 26
  • 27
  • 28
  • 30
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]