-
Notifications
You must be signed in to change notification settings - Fork 0
/
wonder.py
41 lines (32 loc) · 994 Bytes
/
wonder.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
class Wonder(object):
def __init__(self, name, resource, stages):
"""
Args:
name: Name of the wonder.
resource: The resource that the wonder provides.
stages: List of stages, in order.
"""
self.name = name
self.resource = resource
self.stages = stages
def __eq__(self, other):
return self.__dict__ == other.__dict__
def __str__(self):
return self.__class__.__name__ + ': ' + str(self.__dict__)
def __repr__(self):
return '<' + str(self) + '>'
class Stage(object):
def __init__(self, cost, bonus):
"""
Args:
cost: Cost of building the stage. A dict of resource type to amount, e.g. {'WOOD':1, 'COIN':3}
bonus: The bonus this stage provides.
"""
self.cost = cost
self.bonus = bonus
def __eq__(self, other):
return self.__dict__ == other.__dict__
def __str__(self):
return self.__class__.__name__ + ': ' + str(self.__dict__)
def __repr__(self):
return '<' + str(self) + '>'