You are on page 1of 2

#battle bot program

#
#
def main():
endProgram ='no'
ammo=int(0)
while endProgram == 'no':
    fuel = 200
    fuel = float (fuel)
    print

    #display menu
    print 'Menu Selections: '
    print '1 - Fire Weapon '
    print '2 - Move Forward '
    print '3 - Move Backward '
    print '4 - Exit '

    #check menu selection


    choice = input ('Enter your selection ')
    choice = float (choice)
    if choice == 1:
        print ammo
        ammo=ammo+1
        print ammo
        if ammo <= 5:
            ammo=kill()
        elif ammo > 5:
            print 'You are out of ammunition'
            print ammo
            return ammo
    elif choice == 2:
        move = moveBot(fuel)
    elif choice == 3:
        move = moveBot(fuel)
    elif choice == 4:
        Exit = end()
    elif choice >= 5:
        print 'Not a valid action '
        print 'Please try again '
    else:
        endProgram = raw_input ('Do you want to end program?')
    ('Enter yes or no):')
while not (endProgram == 'yes' or endprogram == 'no'):
        print 'Please enter a yes or no '
        endProgram == raw_input ('Do you want to end program?')

#fire weapion 5 shots only


def fire(ammo):
    print ammo
    ammo = ammo + 1
    print ammo
    if ammo <= 5:
        fire = kill(ammo)
    elif ammo > 5:
        print 'You are out of ammunition! '
        return
    else:
        return

#move bot
def moveBot(fuel):
    fuel = input ('How far would you like to move? ')
   

#kill enemy
def kill():
    print
    print 'How far away is the enemy? '
    killDis = input ('Enter distance in feet now! ')
    #check effect
    if killDis <= 20:
        print 'Enemy has been destroyed! '
        return
    elif killDis <= 40:
        print 'Enemy has been partially disabled. '
        return
    elif killDis >= 41:
        print 'The enemy has been unharmed! '
        return

#end program
def end():
    endProgram = raw_input ('Do you want to end program? yes or no ')

#calls main
main()

You might also like