Jump to content
Existing user? Sign In

Sign In



Sign Up

Holding Challenge Simulator 1.1.1


1 Screenshot

About This File

Very rudimentary holding challenge generator.

First try at this sort of thing.

Give it a shot! Report any bugs.

 

Thanks!

 

-Skipper


What's New in Version 1.1.1

Released

Added multithreading so you can add drinks while the computers bladder is filling!

 

Fixed a few other bugs that caused critical errors.

 

Thanks!


User Feedback

Recommended Comments

300
Traceback (most recent call last):
  File "C:\Users\****\Downloads\hold.py", line 111, in <module>
    drinking()
  File "C:\Users\****\Downloads\hold.py", line 68, in drinking
    computerPercent = (computerBladder / cBladderCap)*100
ZeroDivisionError: float division by zero
 

This error keeps appearing every time I type in how much I drink.

Link to comment
  • 🌟 OmoOrg VIP
25 minutes ago, WavyBaby said:

When I try and run the program I get the error "ModuleNotFoundError: No module named 'numpy'" any thoughts?

 

Try installing the Anaconda distro (as opposed to the barebones one). It includes lots of stuff, including NumPy. If you know what you're doing, you can just pip it.

Link to comment

Yeah this file imports a few libraries that aren't going to be installed on everyone's computer, so I'd highly suggest building using pyinstaller.

With that said, I have a few comments looking at this code:

  • That is a lot of global variables. I'm not an expert on the subject but I think it's agreed upon that global variables are an unadvisable way to organize your code. I'm not being very helpful here since I don't have a specific alternative in mind, but it's probably something to remember.
  • There are a lot of redundant conditionals in your computerPercent segment. I would do:

if computerPercent < 30:
  [do something, or put 'pass' if you don't do anything]
elif computerPercent < 50:
  do something
elif computerPercent < 70:
  do something
elif computerPercent < 90:
  do something
elif computerPercent < 100:
  do something
else:
  do something

  • You might want to call .lower() on your text input and maybe .strip() too to make it easier for the user. Alternatively, use numbers for input (e.g. 1. Easy 2. Normal 3. Hard 4. Random)
  • Difficulty is capitalized, which is usually reserved for class names. You probably set it that way to avoid conflict with the difficulty variable, but I'd suggest instead calling it setDifficulty() or something.

Or you can completely ignore me! All this stuff is just details of coding practice, and it doesn't affect how your program works on a major level.

Link to comment
3 hours ago, Skipperjoe said:

Thanks for the suggestions! Literally my first program that wasn't an exercise in a tutorial.

Any time! I love looking at code and tearing apart all the ways it could be better. For a first program, it's pretty solid; I'd just favor passing things into functions rather than putting global variables everywhere.

Now my feedback is that I don't know what these numbers mean (despite the fact that I've looked at the source code). Labeling your output goes a long way, and that applies whether you're giving output to the user or printing it for debugging purposes.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...