Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. # ”エシ”
  2. import random
  3. random.seed() # Take seed from sysclock
  4. # Teams are: SOVWAR, QUESOC, AMFOR, DESCA, LIFOUR
  5. class team:
  6. def __init__(self, _name):
  7. self.name = _name
  8. population = 0
  9. stockpile = 0
  10. name = "DEFAULT"
  11. def fireat(self, _team):
  12. if self.stockpile > 0:
  13. _team.population -= random.randint(50,100)
  14.  
  15. print("""
  16. _ _
  17. | | (_)
  18. ___ ___| |__ _
  19. / _ \/ __| '_ \| |
  20. | __/\__ \ | | | |
  21. \___||___/_| |_|_|""")
  22.  
  23. PLAYERS = {'SOVWAR': team('SOVWAR'),
  24. 'QUESOC': team('QUESOC'),
  25. 'AMFOR': team('AMFOR'),
  26. 'DESCA': team('DESCA'),
  27. 'LIFOUR': team('LIFOUR')};
  28. print (" I N I T ")
  29. for k in PLAYERS:
  30. print(PLAYERS[k].name, end="; ")
  31. PLAYERS[k].stockpile= random.randint(0,100)
  32. print("Missiles: %d /" %PLAYERS[k].stockpile, end = " ")
  33. PLAYERS[k].population = random.randint(100,500)
  34. print("Population: %d" %PLAYERS[k].population)
  35. for k in PLAYERS:
  36. turns = []
  37. turns.append(PLAYERS[k].name)
  38. j = 0
  39. while True:
  40. print("%s Turn >" % turns[j], end = " ")
  41. _input = input()
  42. _input.upper()
  43. if _input == "FIRE":
  44. print("at whom >", end = " ")
  45. _input = input()
  46. if _input in PLAYERS:
  47. PLAYERS[_input].population -= random.randint(1,25)
  48. PLAYERS[turns[j]].stockpile -= 1
  49. print("%s pop: %d. %s stockpile: %d" % (PLAYERS[_input].name, PLAYERS[_input].stockpile, PLAYERS[turns[j]].name, PLAYERS[turns[j]].stockpile))
  50.  
  51.  
  52.  
  53. j = j+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement