-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent.py
62 lines (53 loc) · 1.38 KB
/
agent.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
class Agent:
"""
Agent class interface.
TODO: add more complex inventory for different type of objects
"""
def __init__(
self,
name: str,
inventory: int
):
"""
Instantiate the agent.
:param name: String. Agent's name.
:param inventory: Inventory of objects.
"""
self.name = name
self.inventory = inventory
def __str__(self):
return f"{self.name}: {self.inventory}"
class Seller(Agent):
"""
A Seller refers to an agent with the goal of selling objects.
"""
def __init__(
self,
name,
inventory,
money,
min_price,
price_expectation
):
super().__init__(name, inventory)
self.money = money
self.min_price = min_price
self.price_expectation = price_expectation
self.has_recently_sold = False
class Buyer(Agent):
"""
A Buyer refers to an agent with the goal of buying objects.
"""
def __init__(
self,
name,
inventory,
money,
max_budget,
price_expectation
):
super().__init__(name, inventory)
self.money = money
self.max_budget = max_budget
self.price_expectation = price_expectation
self.has_recently_bought = False