-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcountry.py
37 lines (27 loc) · 959 Bytes
/
country.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
import numpy as np
from country_types import CountryType
from constants import Constant
import string
import random
class Country:
def __init__(self, representation, type = CountryType.INIT):
self.colonies = []
self.type = type
self.representation = representation
self.cost = self.calculateCost()
self.name = ''.join(random.choices(string.ascii_lowercase, k=3))
def calculateCost(self):
return np.sum(np.multiply(np.array(Constant.ETC).T, self.representation))
@property
def isColony(self):
return self.type == CountryType.COLONY
@property
def isImperialist(self):
return self.type == CountryType.IMPERIALIST
def getCost(self):
return self.cost
def getRepresentation(self):
return self.representation
def setRepresentation(self, representation):
self.representation = representation
self.cost = self.calculateCost()