46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
from abc import ABC
|
|
class Business(ABC):
|
|
def __init__(self,id,production,balance) -> None:
|
|
"""production (dict): {
|
|
name: 'Gem',
|
|
amount: 4,
|
|
craft: {
|
|
'Raw_Gem': 4,
|
|
'Tool_Gem': 0.2,
|
|
}
|
|
}
|
|
balance (int): Starting Balance
|
|
"""
|
|
self.id=id
|
|
self.production=production
|
|
self.balance_history=[balance]
|
|
self.balance=balance
|
|
#Setup Inventory
|
|
self.inventory={production["name"]: 0}
|
|
for l in production["prod"]:
|
|
for k,v in l.items():
|
|
self.inventory[k]=0
|
|
pass
|
|
|
|
def tick(self,step):
|
|
self.tick_business_decisions(step)
|
|
|
|
def tick_business_decisions(self,step):
|
|
assert "no business decision method has been created"
|
|
pass
|
|
|
|
def tick_episode(self,episode_count):
|
|
"""
|
|
Call for resetting for the next episode
|
|
"""
|
|
self.balance_history.append(self.balance)
|
|
self.tick_business_episode(episode_count)
|
|
|
|
|
|
def tick_business_episode(self,episode_count):
|
|
"""
|
|
Call for resetting for the next episode
|
|
"""
|
|
assert "no business episode tick method has been created"
|
|
|