1. #Robot Battlebot
  2. #Notice the debug and testing codes :)
  3.  
  4. def main():
  5. menu = 0
  6. fuel = 200
  7. ammo = 5
  8. while menu != 6:
  9. print 'Menu Selections:'
  10. print #blank
  11. print '1 - Fire'
  12. print '2 - Forward'
  13. print '3 - Back'
  14. print '4 - Ammo'
  15. print '5 - Fuel'
  16. print '6 - Exit'
  17. print #blank
  18. print 'Enter your selection as 777 to reset all values'
  19. print #blank
  20. menu = input('Enter your selection: ')
  21. if menu == 1:
  22. ammo = fireWeapon(ammo)
  23. elif menu == 2:
  24. fuel = moveForward(fuel)
  25. elif menu == 3:
  26. fuel = moveBackward(fuel)
  27. elif menu == 4:
  28. print #blank
  29. print 'You have',ammo,'shot(s) left'
  30. print #blank
  31. elif menu == 5:
  32. print #blank
  33. print 'You have',fuel,'unit(s) of fuel left'
  34. print #blank
  35. elif menu == 6:
  36. print 'Goodbye'
  37. elif menu == 1337:
  38. print #blank
  39. print 'ACCESS GRANTED'
  40. print 'POWERING UP'
  41. print #blank
  42. ammo = ammo + 200
  43. fuel = fuel + 100000
  44. elif menu == 666:
  45. print #blank
  46. print '*'
  47. print '**'
  48. print '***'
  49. print '****'
  50. print '*****'
  51. print '??????'
  52. print '*****'
  53. print '****'
  54. print '***'
  55. print '**'
  56. print '*'
  57. print #blank
  58. ammo = 0
  59. fuel = 0
  60. elif menu == 777:
  61. print #blank
  62. print 'Reset'
  63. print #blank
  64. ammo = 5
  65. fuel = 200
  66. else:
  67. print #blank
  68. print 'Invalid selection'
  69. print #blank
  70.  
  71. def fireWeapon(ammo):
  72. if ammo > 0:
  73. ammo = ammo - 1
  74. print #blank
  75. print 'Weapon loaded'
  76. print #blank
  77. fireRange = input('Input distance to enemy in feet: ')
  78. if fireRange <= 20:
  79. print #blank
  80. print 'Enemy destroyed'
  81. print 'You have',ammo,'shot(s) left'
  82. print #blank
  83. elif fireRange > 20 and fireRange <= 40:
  84. print #blank
  85. print 'Enemy disabled'
  86. print 'You have',ammo,'shot(s) left'
  87. print #blank
  88. elif fireRange > 40:
  89. print #blank
  90. print 'You missed!'
  91. print 'You have',ammo,'shot(s) left'
  92. print #blank
  93. else:
  94. print #blank
  95. print 'You are out of ammo'
  96. print #blank
  97. return ammo
  98.  
  99. def moveForward(fuel):
  100. if fuel >= 1:
  101. fDistance = input('Input move distance in feet: ')
  102. if fDistance > fuel:
  103. print #blank
  104. print 'Not enough fuel. The robot has',fuel,'unit(s) of fuel left'
  105. print #blank
  106. else:
  107. fObs = input('Input distance to obstacle in feet: ')
  108. fBlock = fObs - 1
  109. if fDistance >= fObs:
  110. print #blank
  111. print 'The obstacle is blocking your path'
  112. print 'You can move',fBlock,'feet before hitting the obstacle'
  113. print #blank
  114. else:
  115. print #blank
  116. print 'Move successful!'
  117. fuel = fuel - fDistance
  118. print 'You moved forward',fDistance,'feet and have',fuel,'unit(s) of fuel left'
  119. print #blank
  120. else:
  121. print #blank#
  122. print 'You are out of fuel'
  123. print #blank#
  124. return fuel
  125.  
  126. def moveBackward(fuel):
  127. if fuel >= 1:
  128. bDistance = input('Input move distance in feet: ')
  129. if bDistance > fuel:
  130. print #blank
  131. print 'Not enough fuel. The robot has',fuel,'unit(s) of fuel left'
  132. print #blank
  133. else:
  134. bObs = input('Input distance to obstacle in feet: ')
  135. bBlock = bObs - 1
  136. if bDistance >= bObs:
  137. print #blank
  138. print 'The obstacle is blocking your path'
  139. print 'You can move',bBlock,'feet before hitting the obstacle'
  140. print #blank
  141. else:
  142. print #blank
  143. print 'Move successful!'
  144. fuel = fuel - bDistance
  145. print 'You moved backward',bDistance,'feet and have',fuel,'unit(s) of fuel left'
  146. print #blank
  147. else:
  148. print #blank
  149. print 'You are out of fuel'
  150. print #blank
  151. return fuel
  152.  
  153. main()
  154.