Guest User

Untitled

a guest
Feb 28th, 2013
23
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. import os
  3. from random import choice
  4.  
  5. #this is just some word generator that you can ignore
  6.  
  7. baseGoods = ['grain', 'wool', 'wine', 'wool', 'cloth', 'fish', 'fur', 'salt']
  8. metalGoods = ['iron', 'copper', 'gold', 'slaves']
  9. rareGoods = ['ivory', 'tea', 'chinaware', 'spices', 'coffee', 'cotton', 'sugar', 'tobacco']
  10. seaGoods = ['fish', 'salt']
  11.  
  12. start = ['pro', 'eka', 'ela', 'eda', 'eqa', 'eva', 'ema', 'deca', 'penta', 'tetra','mono', 'di', 'octo', 'nono', 'nio', 'sevo', 'plevo', 'gevo','ube','ubi']
  13. general = ['cuv','fux', 'moh', 'sad', 'num', 'ur', 'del', 'pon', 'hap', 'ni', 'uvi', 'lud', 'drom', 'gel', 'wut', 'dar', 'bla',
  14. 'sub', 'mud', 'bv', 'nue', 'nub', 'meh', 're', 'hdo', 'ossi', 'tasi', 'felr', 'ris', 'uli', 'lite','sto', 'wum', 'go',
  15. 'du', 'mu', 'yuno', 'yuki', 'fluvi', 'kol']
  16. end = ['stan', 'vie', 'vino', 'led', 'stad', 'grad', 'frad', 'lox', 'klop', 'clox', 'krax', 'prad', 'detm', 'blr', 'vlad', 'wan','dron', 'phron']
  17. start = start
  18. middle = general
  19. end = end
  20. def genword():
  21. herp = random.choice(start)+random.choice(middle)+random.choice(end)
  22. return herp
  23.  
  24.  
  25. #province stuff really starts here
  26. class Province:
  27.  
  28. def __init__(self, tag, religion, culture, techgroup = [], hre = False, sea = None, rare = None, avgtax = 7, vartax = 4):
  29. #strings:
  30. #tag, religion, culture
  31.  
  32. #bool:
  33. #hre, sea, rare
  34.  
  35. #int:
  36. #avgtax, vartax
  37.  
  38. #list:
  39. #techgroups
  40. self.discover = techgroup
  41. self.tag = tag
  42. self.religion = religion
  43. self.culture = culture
  44. self.hre = hre
  45. self.sea = sea
  46. self.rare = rare
  47. self.taxVariation = vartax
  48. self.taxAverage = avgtax
  49.  
  50. #sea as in touching the ocean
  51. #rare as in rare goods
  52. #avgtax is average tax, var tax is variation
  53.  
  54. def provRare(self):
  55. if self.rare is None:
  56. raretest = random.randint(0,5)
  57. if raretest == 0:
  58. self.rare = True
  59. elif raretest != 0:
  60. self.rare = False
  61.  
  62. def provSea(self):
  63. if self.sea is None:
  64. self.sea = False
  65.  
  66. def provPossesion(self):
  67. self.add_core = self.tag
  68. self.owner = self.tag
  69. self.controller = self.tag
  70. #defines who posseses the province and stuff
  71.  
  72. def provTax(self):
  73. self.tax = int(random.gauss(7,4))
  74. if self.tax < 1 or self.tax > 15:
  75. self.tax = self.taxAverage
  76. #figures out the base tax of the province
  77.  
  78. def provGood(self):
  79. if self.rare is True:
  80. self.good = random.choice(rareGoods)
  81. elif self.sea is True and random.randint(0,3) == 0:
  82. self.good = random.choice(seaGoods)
  83. elif random.randint(0,1) == 0:
  84. self.good = random.choice(metalGoods)
  85. else:
  86. self.good = random.choice(baseGoods)
  87.  
  88. def provManpower(self):
  89. self.manpower = int(random.gauss(3,2))
  90. if self.manpower < 1 or self.manpower > 6:
  91. self.manpower = 3
  92.  
  93. def provCitysize(self):
  94. self.citysize = int(random.gauss(2000,5000))
  95. if self.citysize < 100:
  96. self.citysize = 2000
  97.  
  98. def provCapital(self):
  99. self.capital = genword() #hook up your favorite word generator here or something.
  100.  
  101. def provBuilding(self):
  102. self.fort1 = True
  103. if self.sea is True:
  104. if random.randint(0,2) == 0:
  105. self.dock = True
  106. else:
  107. self.dock = False
  108. else:
  109. self.dock = False
  110. if random.randint(0,5) == 0:
  111. self.temple = True
  112. else:
  113. self.temple = False
  114. if random.randint(0,5) == 0:
  115. self.armory = True
  116. else:
  117. self.armory = False
  118. if random.randint(0,5) == 0:
  119. self.constable = True
  120. else:
  121. self.constable = False
  122. if random.randint(0,5) == 0:
  123. self.marketplace = True
  124. else:
  125. self.marketplace = False
  126. if random.randint(0,5) == 0:
  127. self.workshop = True
  128. else:
  129. self.workshop = False
  130.  
  131. def provAssembly(self):
  132. self.province = []
  133. self.province.append('add_core = ' + self.add_core)
  134. self.province.append('\n')
  135. self.province.append('owner = ' + self.owner)
  136. self.province.append('\n')
  137. self.province.append('controller = ' + self.controller)
  138. self.province.append('\n'+'\n')
  139. self.province.append('culture = ' + self.culture)
  140. self.province.append('\n')
  141. self.province.append('religion = ' + self.religion)
  142. self.province.append('\n')
  143. if self.hre is True:
  144. self.province.append('hre = yes')
  145. elif self.hre is False:
  146. self.province.append('hre = no')
  147. self.province.append('\n')
  148. self.province.append('base_tax = ' + str(self.tax))
  149. self.province.append('\n')
  150. self.province.append('trade_goods = ' + str(self.good))
  151. self.province.append('\n')
  152. self.province.append('manpower = ' + str(self.manpower))
  153. self.province.append('\n')
  154. self.province.append('citysize = ' + str(self.citysize))
  155. self.province.append('\n')
  156. self.province.append('capital = ' + '"'+self.capital+'"')
  157. self.province.append('\n')
  158. if self.fort1 is True:
  159. self.province.append('fort1 = yes')
  160. self.province.append('\n')
  161. if self.temple is True:
  162. self.province.append('temple = yes')
  163. self.province.append('\n')
  164. if self.dock is True:
  165. self.province.append('dock = yes')
  166. self.province.append('\n')
  167. if self.constable is True:
  168. self.province.append('constable = yes')
  169. self.province.append('\n')
  170. if self.workshop is True:
  171. self.province.append('workshop = yes')
  172. self.province.append('\n')
  173. if self.marketplace is True:
  174. self.province.append('marketplace = yes')
  175. self.province.append('\n')
  176. if self.armory is True:
  177. self.province.append('armory = yes')
  178. self.province.append('\n')
  179. if random.randint(0,8) == 1:
  180. self.province.append('university = yes')
  181. self.province.append('\n')
  182. for string in self.discover:
  183. self.province.append('discovered_by = ' + string)
  184. self.province.append('\n')
  185. self.province = ''.join(self.province)
  186.  
  187. #everything after here is irrelevant to the overall scheme
  188.  
  189. def kallistoProvince():
  190. randprov = Province('KAL', 'aethist', 'kolokian', techgroup = ['kolokia', 'lysteriok'], hre = False, sea = None, rare = None, avgtax = 7, vartax = 4)
  191. randprov.provRare()
  192. randprov.provSea()
  193. randprov.provPossesion()
  194. randprov.provTax()
  195. randprov.provGood()
  196. randprov.provManpower()
  197. randprov.provCitysize()
  198. randprov.provCapital()
  199. randprov.provBuilding()
  200. randprov.provAssembly()
  201. randprovfile = randprov.province
  202. return randprovfile
  203.  
  204. for x in xrange(0,10):
  205. print kallistoProvince()
  206. print '########'
  207.  
  208. os.system('pause')
RAW Paste Data