Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import random

dictName1 = { (1,1): 'Hammer', (1,2): 'Sigmar\'s ', (1,3): 'Anvil', (1,4): 'Forge', (1,5): 'Iron', (1,6): 'Hallow',
              (2,1): 'Tempest\'s ', (2,2): 'Flame', (2,3): 'Dread', (2,4): 'Frost', (2,5): 'Helden', (2,6): 'Seer\'s ',
              (3,1): 'Grey', (3,2): 'Hero', (3,3): 'Sky', (3,4): 'Dragon', (3,5): 'Lion', (3,6): 'Hel',
              (4,1): 'Sun', (4,2): 'Phoenix', (4,3): 'Star', (4,4): 'Candle', (4,5): 'Skull', (4,6): 'Far',
              (5,1): 'Ancestor\'s ', (5,2): 'Bale', (5,3): 'Prism', (5,4): 'Mist', (5,5): 'Shade', (5,6): 'Spite',
              (6,1): 'Midden', (6,2): 'Grand', (6,3): 'Regal', (6,4): 'Stone', (6,5): 'Silver', (6,6): 'Glimmer'}
              
dictName2 = { (1,1): 'Spire', (1,2): 'Forge', (1,3): 'Hold', (1,4): 'Stone', (1,5): 'Fort', (1,6): 'Castle',
              (2,1): 'Aerie', (2,2): 'Heart', (2,3): 'Vale', (2,4): 'Redoubt', (2,5): 'Port', (2,6): 'Heim',
              (3,1): 'Berg', (3,2): 'Keep', (3,3): 'Eye', (3,4): 'Dorf', (3,5): 'Fyrd', (3,6): 'Fang',
              (4,1): 'Guild', (4,2): 'Sword', (4,3): 'Held', (4,4): 'Tower', (4,5): 'Pillar', (4,6): 'Opolis',
              (5,1): 'Bane', (5,2): 'Fastness', (5,3): 'Hallow', (5,4): 'Vault', (5,5): 'City', (5,6): 'Bane'}
              
dictRealm = { (1,1): 'Mobile', (1,2): 'Aqshy', (1,3): 'Ghyran',
              (2,1): 'Ghur', (2,2): 'Ulgu', (2,3): 'Shyish',
              (3,1): 'Chamon', (3,2): 'Hysh'}
              
dictSize = {1: 'Watchpost', 2: 'Hamlet', 3: 'Village', 4: 'Town', 5: 'City', 6: 'Sprawling Metropolis'}

dictInhabitants = {1: 'Humans', 2: 'Aelves', 3: 'Duardin', 4: 'Stormcast Eternals', 5: 'Sylvaneth', 6: 'Seraphon'}

dictNumberFeature = {1: 'little note', 2: 'some notoriety', 3: 'general novelty', 4: 'general novelty', 5: 'renown', 6: 'legend'}

dictDetailFeature = { (1,1): 'being underground', (1,2): 'surrounding magical barrier', (1,3): 'notorious thieves guild', 
                      (1,4): 'master craftsmen', (1,5): 'being held aloft by magical means', (1,6): 'great armoury',
                      (2,1): 'college of magic', (2,2): 'renowned gunnery school', (2,3): 'Stormcast Eternal stormkeep', 
                      (2,4): 'arcane forge', (2,5): 'Kharadron Overlord trading port', (2,6): 'Scourge Corsair sea port',
                      (3,1): 'underground Darkling Coven cult', (3,2): 'realmgate', (3,3): 'mineral deposits', 
                      (3,4): 'being the site of a great battle', (3,5): 'legendary library', (3,6): 'mysterious ruins',
                      (4,1): 'Orruk raids', (4,2): 'sinister reputation', (4,3): 'monster\'s graveyard', 
                      (4,4): 'Fyreslayer lodge', (4,5): 'nexus of magical power', (4,6): 'relic from the World That Was',
                      (5,1): 'Order Draconis/Serpentis Garrison', (5,2): 'notable Freeguild', (5,3): 'huge agricultural bounty', 
                      (5,4): 'lingering Chaos catastrophe', (5,5): 'sealed and terrible vault', (5,6): 'massive mausoleum',
                      (6,1): 'renowned observatory and orreries', (6,2): 'populace being plagued by dreams', (6,3): 'legendary monster hunters',
                      (6,4): 'Disposessed masons', (6,5): 'sylvaneth woods', (6,6): 'mysterious plague'}
                      
def d(z):
  return random.randint(1,z)
  
def dd(z):
  return (d(z),d(z))
  
def setToStringFormat(string, setx):
  q = len(setx)
  if q > 1:
    while q > 0:
      if q == 1:
        string = string + " and " + setx.pop() + "."
      elif q == 2:
        string = string + setx.pop()
      else:  
        string = string + setx.pop() + ", "
      q -= 1
  else:
    string = string + setx.pop() + "."
  return string

freeCities = 6
while freeCities > 0:
  ntup1 = (dd(6))
  ntup2 = (dd(6))
  rtup = (dd(3))
  sint = d(6)
  iint = d(3)
  ndfint = d(6)
  
  name = dictName1[ntup1]
  realm = ""
  size = dictSize[sint]
  inhabitants = set()
  inhabitantsStr = ""
  numberFeature = dictNumberFeature[ndfint]
  detailFeature = set()
  detailFeatureStr = ""
  
  if ntup2[0] == 6:
    ntup2 = (dd(6))
    while ntup1 == ntup2:
      ntup2 = (dd(6))
    name = name + dictName1[ntup2]
  else:
    name = name + dictName2[ntup2]
    
  if rtup == (3,3):
    while rtup == (3,3):
      rtup = (dd(3))
    realm = realm + dictRealm[rtup] + "-"
    rtup = (dd(3))
    while rtup == (3,3):
      rtup = (dd(3))
    realm = realm + dictRealm[rtup] 
  else:
    realm = realm + dictRealm[rtup]
    
  if sint > 2:
    iint += 1
    
  while iint >  0:
    inhabitants.add(dictInhabitants[random.randint(1,6)])
    iint -= 1
    
  inhabitantsStr = setToStringFormat(inhabitantsStr, inhabitants)
    
  if ndfint == 1:
    detailFeature.add(dictDetailFeature[dd(6)])
  elif ndfint == 2:
    n = d(3)
    while n > 0:
      detailFeature.add(dictDetailFeature[dd(6)])
      n -= 1
  elif ndfint == 3 or ndfint == 4:
    n = d(3) + 1
    while n > 0:
      detailFeature.add(dictDetailFeature[dd(6)])
      n -= 1
  elif ndfint == 5:
    n = d(3) + 2
    while n > 0:
      detailFeature.add(dictDetailFeature[dd(6)])
      n -= 1
  else:
    n = d(6)
    while n > 0:
      detailFeature.add(dictDetailFeature[dd(6)])
      n -= 1
      
  detailFeatureStr = setToStringFormat(detailFeatureStr, detailFeature)
      
  print('Name: ' + name.upper())
  print('Realm: ' + realm)
  print('Size: ' + size)
  print('Inhabitants: ' + inhabitantsStr)
  print('Distinguishing Features: A location of ' + numberFeature + ', known for its ' + detailFeatureStr + "\n")
  freeCities -=1
Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux