def main():
endProgramBool = False
ammunition = 5
fuel = 200.0
totalFeet = 0
enemyDistance = 200
while not endProgramBool:
print 'Menu Selections: '
print '1 - Fire Weapon '
print '2 - Move Forward '
print '3 - Move Backward '
print '4 - Exit '
choice = input('Enter your selection ')
if choice == 1:
ammunition = fire(ammunition)
elif choice == 2:
fuel = moveFor(fuel)
elif choice == 3:
moveBackward = moveBack(fuel)
elif int(choice) == 4:
print 'Goodbye!'
endProgram()
else:
print 'Error: Invalid selection.'
def fire(ammunition):
if ammunition >= 1:
fire = attack()
else:
print 'You are out of ammunition!'
ammunition = ammunition - 1
print ammunition
return ammunition
def moveFor(fuel):
print fuel
moveFor = input ('How far would you like to move?')
if moveFor <= fuel:
fuel = fuel - moveFor
elif fuel == 0:
print 'You have no fuel left!'
elif moveFor > fuel :
print 'You need more fuel to move!'
print fuel
return fuel
def moveBack(fuel):
print fuel
moveBack = input ('How far would you like to move?')
if moveBack <= fuel:
fuel = fuel - moveBack
elif fuel == 0:
print 'You have no fuel left!'
elif moveBack > fuel:
print 'You need more fuel to move!'
print fuel
return fuel
def fuelLeft(fuel):
fuelLeft = (fuel - moveFor or fuel - moveBack)
def attack():
print 'How far away is the enemy? '
attackDis = input ('Enter distance in feet. ')
if attackDis <= 10:
print 'Enemy has been destroyed! '
return
elif attackDis <= 25:
print 'Enemy has been partially disabled. '
return
elif attackDis >= 26:
print 'The enemy has been unharmed! '
return
def endProgram():
print 'Y or N:'
true = raw_input('Do you wish to exit this program?')
if true == 'y' or true == 'Y':
quit()
elif true == 'n' or true == 'N':
print 'Welcome back.'
return
else:
print 'Error: Invalid selection.'
#calls main
main()
how do i convert python into Raptor(flowchart)ok i have the python code but i dont know how to start in raptor.
Page 1 of 1
1 Replies - 4417 Views - Last Post: 10 January 2011 - 09:43 AM
#1
how do i convert python into Raptor(flowchart)
Posted 25 February 2010 - 04:32 PM
ok how do i start this off in raptor because to be honest im confused and dont know how to start it..so can someone help me
Replies To: how do i convert python into Raptor(flowchart)
#2 Guest_Purple Bill*
Re: how do i convert python into Raptor(flowchart)
Posted 10 January 2011 - 09:43 AM
ittragin, on 25 February 2010 - 03:32 PM, said:
ok how do i start this off in raptor because to be honest im confused and dont know how to start it..so can someone help me
It's probably too late now, but here's how to start it off:
Begin with 5 statement boxes to initialize your beginning variable values.
Then insert a loop statement.
Above the loop statement, insert output boxes to show the user his options.
Insert some decision boxes for your if then else statement.
For each decision, have it call a module.
etc....
Edited by Dogstopper: Please don't use a text color that is nearly impossible to see....
This post has been edited by Dogstopper: 10 January 2011 - 09:48 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote


|