Why is this program repeating itself?
<p>I am trying to get a game from exercise 36 in <a href="http://www.learnpythonthehardway.org" rel="nofollow">LPTHW</a> to work. </p>

<p>I can get the whole part of the game working except when it gets to the combat. Here is where I think the problem is. </p>

<pre><code>def combat_engine():    
    global wins, hit_points, current_hp
    if monster_current_hp or current_hp &gt; 0:
        print "You can type 'a' for attack, or 'q' for quit, choose one."
        answer = raw_input(":&gt; ")
        if 'a' in answer:
            attack(monster)
            attack('player')
            combat_engine()
        elif 'q' in answer:
            print t.white_on_red("You give up and are devoured by the %s.") % monster
            exit(0)
        else:
            print "I dont understand %s." % answer
            next()
            combat_engine() 
    elif monster_hp == 0:
        print "You defeated the %s, congradulations %s!" % monster, name
        wins = wins + 1
        if wins == 5:
            you_win()
        elif victim == 'player':
            hit_points = hit_points + d6()
            current_hp = hit_points
            print "You feel hardier."
            next()
            barracks()
    elif current_hp == 0:
        print "You have been deafeted by the %s, better luck next time." % monster
        next()
        exit(0)

    else: 
        print "Bug Somewhere"
</code></pre>

<p>I believe the bug is somewhere in this function. When i printed out the HP values of each character, the battle was still going on after the monster had been reduced to -2 hp. maybe it a problem with booleans? </p>

<p>What I would like it to do is to either do all the stat adjustments for winning and quit the game if you lose. I just want to get past this so I can start learning about classes and dicts which should make my life much easier. Please let me know if I should post more information, I'm new at this and not the best at posting questions on here yet. </p>

<p>Thanks in advance! </p>
