Bug
I ran your game and here is the output:
$ python3 test.py
Welcome to Camel!
You have stolen a camel to make your way across the great Mobi desert.
The natives want their camel back and are chasing you down! Survive your desert trek and out run the natives.
A. Drink from your canteen.
B. Ahead at moderate speed.
C. Ahead full speed.
D. Stop for the night.
E. Status check
Q. Quit.
Your choice? D
Your camel feels refreshed and happy his fatigue is now 0
Traceback (most recent call last):
File "test.py", line 73, in <module>
if oasis == 20:
NameError: name 'oasis' is not defined
If I select any option other than C and D, I get the NameError. You can fix it by adding
oasis = 0
before the while loop.
Suggestions
This
print("Welcome to Camel!") print("""You have stolen a camel to make your way across the great Mobi desert. The natives want their camel back and are chasing you down! Survive your desert trek and out run the natives.""") print()can be written as
print("Welcome to Camel!") print("""You have stolen a camel to make your way across the great Mobi desert. The natives want their camel back and are chasing you down! Survive your desert trek and out run the natives.\n""")Similarly,
print(""" A. Drink from your canteen. B. Ahead at moderate speed. C. Ahead full speed. D. Stop for the night. E. Status check Q. Quit.""") print()can be written as
print(""" A. Drink from your canteen. B. Ahead at moderate speed. C. Ahead full speed. D. Stop for the night. E. Status check Q. Quit.\n""")thereby eliminating the need for a seperate
print().You can eliminate the need for a
Donevariable by using an infinite loopwhile True:and replacing every
Done = Truewithbreak. This will also eliminate the need for usingand not donein some of the conditions.Instead of doing stuff like
camelFatigue *= 0 thirst *= 0You can use
camelFatigue = thirst = 0You have
if userInput.lower() == "q": # ... elif userInput.lower() == "e": # ... elif userInput.lower() == "d": # ... elif userInput.lower() == "c": # ... elif userInput.lower() == "b": # ... elif userInput.lower() == "a": # ...You should also have an
elseprinting an error message in case the user enters something invalid. Like so:if userInput.lower() == "q": # ... elif userInput.lower() == "e": # ... elif userInput.lower() == "d": # ... elif userInput.lower() == "c": # ... elif userInput.lower() == "b": # ... elif userInput.lower() == "a": # ... else: print("Invalid input; Try again") # Print error message