title: Using two counters in a loop
body: <p>I have been making a text based game at home using Python and have been having trouble with creating a small section of combat between the player and a foe. The combat is supposed to include two random rolls; one for the player and one for the alien. If the alien rolls higher than the player then +1 should be added to the alien_wins counter and if the player wins +1 should be added to the player_wins counter. </p>
  
  <p>What I want to happen is when the player_wins counter reaches 3 the loop will stop and produce a message, the same should also happen when the alien_ wins reaches 3 but I have had trouble making that work. Any help would be appreciated, Thanks!</p>
  
  <pre><code>import random
  from Tkinter import *
  
  def Fight():
  
      player_wins = 0
      alien_wins = 0
  
      while player_wins &lt;= 3:
  
          player_roll = random.randint(0, 10)
          alien_roll = random.randint(0, 7)
  
          if player_roll &gt; alien_roll:
              contents.set("You manage to fire a shot of your laser pistol and the alien backs off.")
              player_wins += 1
              return
  
          elif alien_roll &gt; player_roll:
              contents.set("The alien reaches out and strikes you with its claws.")
              alien_wins += 1
              return
  
          elif alien_roll == player_roll:
              contents.set("You both grapple eachother and eventually back off.")        
              return
  
              if player_wins == 3:
                  contents.set("You manage to overcome the alien. It leaps from wall to wall and crawls into the vents.")
                  win = True
                  break
              elif alien_wins == 3:
                  contents.set("You lose the fight to the alien. Game Over!")
                  break
  
  base = Tk()
  
  contents = StringVar()
  display = Message(base, textvariable = contents, relief=RAISED)
  display.pack()
  
  enterbutton = Button(base, text = 'Try Again', command = Fight).pack()
  
  base.mainloop()
  </code></pre>