I want to make a game that includes the component of 'lives'. I would like to start the game with 3 lives. Each time the user dies, the lives remaining decreases by 1 and the game restarts with the new number of lives remaining.
PROBLEM: If I play the game and lose a life, it always says "2 lives remaining" even if I only have 1 or 9 lives. Why doesn't the number of lives remaining never go below 2?
This is portion of my code:
import random
def main():
livesRemaining = 3
print "Welcome to Escape From The Shackles! "
print "3 transparent vials with liquid lie in front of you on a table. One of them is green, another is yellow, yet another is red."
colors = ["green", "red", "yellow"]
random.shuffle(colors)
color = raw_input("Which one of the three colors do you choose to drink?")
color = color.lower()
if color == (colors[0]):
print "The liquid seeps into your system and poisons you. You die!"
livesRemaining = livesRemaining - 1
print "You have " + str(livesRemaining) + " lives remaining."
main()
elif color == (colors[1]):
print "Your head begins to spin and you become unconscious! Next thing you know, you're in a raft in a river. No soul is present nearby..."
print "After paddling for 15 minutes in the river, you encounter a crossroads! "
right_or_left = raw_input("Do you choose to paddle right or left?")
right_or_left = yellow_right_or_left.lower()
if yellow_right_or_left == "right":
print "You take a right turn and continue to paddle. A mighty waterfall confronts you."
print "You die!"
livesRemaining = livesRemaining - 1
print "You have " + str(livesRemaining) + " lives remaining."
main()