Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.14 KB | None | 0 0
  1. import random
  2. import time
  3. global eggs
  4. eggs = 0
  5. global queen_health
  6. queen_health = 5
  7. global battle_ants
  8. battle_ants = 2
  9. global work_ants
  10. work_ants = 5
  11. global game_name
  12. game_name = "Antz"
  13. global food
  14. food = 0
  15. global defense
  16. defense = battle_ants*2+work_ants
  17. global day
  18. day = 1
  19. global ant_pop
  20. ant_pop = 1+battle_ants+work_ants
  21. global work_energy
  22. work_energy = 5
  23. global rest
  24. rest = 2
  25. global babys
  26. babys = 0
  27. global colony
  28. colony = ""
  29. global name
  30. name = ""
  31.  
  32. start()
  33.  
  34. def start():
  35. global name
  36. print "Welcome to the World of Ants!"
  37. time.sleep(1)
  38. print ""
  39. print ""
  40. name = raw_input("Please choose a name for your queen:")
  41. print "Alright ",name," you're ready to go!"
  42. print "I must warn you,",name," that this world is a dangerous place."
  43. time.sleep(1)
  44. print "Make sure to watch out for different dangers."
  45. ready = raw_input("Continue Y/N:")
  46. if ready=="Y":pre()
  47. else:
  48. print "Okay then."
  49. def pre():
  50. print "You move away from your family's colony."
  51. time.sleep(1)
  52. print "You will need 100 pieces of food, 5 carpenter ants and 2 fire ants to start a colony."
  53. time.sleep(1)
  54. print "When you have reached this goal you may type establish, to establish your colony."
  55. time.sleep(1)
  56. print "To get started try forging by typing 'forge'."
  57. command = raw_input("Command:")
  58. if command=="forge": s_forge()
  59. def pre_2():
  60. if food > 99:
  61. print "Good Job! You've collected the required food to start a colony."
  62. print "You now must recruit a few ants to join your empire!"
  63. recruit_pre()
  64. else:
  65. command = raw_input("Command:")
  66. if command=="forge": s_forge()
  67. else: pre_2()
  68. def s_forge():
  69. global food
  70. print "Please wait 3 seconds."
  71. print "3 Seconds remaining."
  72. time.sleep(1)
  73. print "2 Seconds remaining."
  74. time.sleep(1)
  75. print "1 Second remaining."
  76. col = random.random()
  77. food1 = col+50
  78. food = food+col+50
  79. print "Food Collected:",food1
  80. print "Total Food:",food
  81. pre_2()
  82. def recruit_pre():
  83. global name
  84. global colony
  85. print "To recruit that ants needed type recruit."
  86. recruit = raw_input("Command:")
  87. if recruit=="recruit":
  88. print "You're ready to establish your colony,",name,"!"
  89. colony = raw_input("Please name your colony:")
  90. print "Alright,",name," your ants are hard at work building ",colony,"."
  91. time.sleep(1)
  92. print "Please wait 5 seconds as they build ",colony,"."
  93. print "5"
  94. time.sleep(1)
  95. print "4"
  96. time.sleep(1)
  97. print "3"
  98. time.sleep(1)
  99. print "2"
  100. time.sleep(1)
  101. print "1"
  102. print "You colony has been constructed!"
  103. day_s()
  104. else: recruit_pre()
  105. def day_s():
  106. global ant_pop
  107. global eggs
  108. global queen_health
  109. global battle_ants
  110. global work_ants
  111. global game_name
  112. global food
  113. global defense
  114. global day
  115. global work_energy
  116. global rest
  117. global babys
  118. print "Day:",day
  119. print ""
  120. print "Total Ant Population:",ant_pop
  121. print " Carpenter Ants:",work_ants
  122. print " Fire Ants:",battle_ants
  123. print " Unassign workers:",babys
  124. print ""
  125. print "Food Supplies:",food
  126. print "Carpenter Ant's Energy:",work_energy
  127. command = raw_input("Command:")
  128. if command =="recruit":
  129. recruit_pre()
  130. if command =="forge":
  131. collect()
  132. if command == "rest":
  133. if rest > 0:
  134. rest = rest-1
  135. print "please wait 3 seconds."
  136. time.sleep(1)
  137. print "2 seconds remaining"
  138. time.sleep(1)
  139. print "1 second remaining"
  140. time.sleep(1)
  141. work_energy=work_energy+1
  142. print "Total work energy:",work_energy
  143. else:
  144. print "You can't rest anymore this day!"
  145. print "Please end the day and try again"
  146. time.sleep(1)
  147. print ""
  148. day_s()
  149. if command == "reproduce":
  150. reproduce()
  151. if command == "end":
  152. pre_day = day
  153. day=day+1
  154. food = food-ant_pop
  155. babys = ant_pop/6
  156. ant_pop=ant_pop+babys
  157. rest = 2
  158. work_energy = 4
  159. ant_pop=battle_ants+work_ants+1+babys
  160. print "The day has ended."
  161. print ""
  162. print "Day",pre_day," Information"
  163. print "Food Used:",ant_pop
  164. print "Babys Born:",babys
  165. print ""
  166. print ""
  167. if food < 1: food = 0
  168. print "You colony is starving!"
  169. percentage = work_ants/10
  170. work_ants = work_ants+percentage
  171. p_fire_ants = battle_ants/20
  172. work_ants = work_ants+p_fire_ants
  173. dif_fire = battle_ants-p_fire_ants
  174. dif_work = work_ants-percentage
  175. print "Fire Ant Deaths:",dif_fire
  176. print "Carpenter Ant Deaths:",dif_work
  177. print "Please consider forging!"
  178. time.sleep(2)
  179. day_s()
  180. day_s()
  181. def collect():
  182. global food
  183. global work_ants
  184. global work_energy
  185. if work_ants > 0:
  186. if work_energy > 0:
  187. print "Your ants are collecting food..."
  188. print "please wait 3 seconds."
  189. time.sleep(1)
  190. print "2 seconds remaining"
  191. time.sleep(1)
  192. print "1 second remaining"
  193. time.sleep(1)
  194. work_energy=work_energy-1
  195. food_collect = random.random()
  196. food_add = food_collect+work_ants
  197. food = food+food_add
  198. food_bonus = random.random()
  199. if food_bonus > 0.7:
  200. print "While your ants were out collecting food they came upon a large mass of food dropped by humans."
  201. choice = raw_input("Would you like to collect this food Y/N:")
  202. if choice=="Y":
  203. food=food+25
  204. work_ants=work_ants-5
  205. print "Food collected: 25"
  206. print "Work Ant Deaths:5"
  207. day_s()
  208. else: s_forge()
  209. print "You've collected ",food_add," pieces of food."
  210. print "Total food:",food
  211. print ""
  212. print "-----------------"
  213. print ""
  214. day_s()
  215. else:
  216. print "You don't have enough energy to perform forging!"
  217. print ""
  218. print ""
  219. time.sleep(2)
  220. day_s()
  221. def reproduce():
  222. global eggs
  223. global work_ants
  224. global battle_ants
  225. global food
  226. choice = raw_input("Would you like to breed fire ants or carpenter ants:")
  227. if choice=="fire ants":
  228. if food > 4: breed_cal = food
  229. fire_ant_cost = 5
  230. number = breed_cal/fire_ant_cost-5
  231. print "You can breed ",number
  232. number_breed = float (raw_input("How many:"))
  233. if number_breed < number:
  234. battle_ants = (battle_ants * 1)+ number_breed
  235. number_breed = number_breed*5
  236. food = food-number_breed
  237. print "Total Fire Ants:",battle_ants
  238. day_s()
  239. else:
  240. print "You don't have enough food for that many fire ants!"
  241. day_s()
  242. else: print "Unknown command."
  243. reproduce()
  244. if choice=="carpenter ants":
  245. if food > 2:
  246. breed_cal = food
  247. carp_ant_cost = 3
  248. number = breed_cal/carp_ant_cost-3
  249. print "You can breed ",number
  250. number_breed = float (raw_input("How many:"))
  251. if number_breed < number:
  252. work_ants = (work_ants * 1)+ number_breed
  253. number_breed = number_breed*3
  254. food = food-number_breed
  255. print "Total Carpenter Ants:",work_ants
  256. day_s()
  257. else: print "You don't have enough food for that many carpenter ants!"
  258. day_s()
  259. else: print "Unknown command."
  260. reproduce()
  261. else: print "Unknown command."
  262. reproduce()
  263. def assign():
  264. global babys
  265. global work_ants
  266. global battle_ants
  267. assign_ants = raw_input("")
  268.  
  269. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement