Python

No description

fork
loading
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
from termcolor import colored

class City():
  '''
  Basic city class which contains basic info, buildings and population
  '''
  def __init__(self, name):
    self.name = name
    self.production = 1
    self.population = 0
    self.farms = 0
    self.wealth = 0
    self.isCapital = True
    self.warriors = []
    self.workers = []
    self.preists = []
  def __repr__(self):
    '''
    Prints a string of the non population attributes of the city
    '''
    return ('City Name: ' if not self.isCapital else 'Capital Name: ') + self.name+'\n'\
    'Production: ' + str(self.production) + '\tWealth: ' + str(self.wealth)+\
    '\tPopulation: '+ str(self.population)+\
    '\tFarms: ' + str(self.farms)+\
    '\nWarriors: '+str(len(self.warriors))+'\tWorkers: '+ str(len(self.workers))

class Person():
  '''
  Person class defines age, gender and job
  '''
  def __init_(self, gender):
    self.gender = gender
    self.age = 0
    self.personClass = ''

class Game():
  name = ''
  running = True
  cities = []
  def ageIncrease():
    print(colored('A year has gone by', 'cyan'))

def stats(game):
  for city in game:
    print(colored(city, 'red'))

game = Game
while game.running:
  cap = City('Cap')
  game.cities.append(cap)
  stats(game.cities)
  game.running = False