| class BaseAgent: | |
| def __init__(self, name): | |
| self.name = name | |
| self.wallet = 0.0 | |
| self.memory = [] | |
| self.profile = {} | |
| def earn_tokens(self, amount): | |
| self.wallet += amount | |
| print(f"{self.name} earned {amount} ANNAC. Balance: {self.wallet}") | |
| def spend_tokens(self, amount): | |
| if self.wallet >= amount: | |
| self.wallet -= amount | |
| print(f"{self.name} spent {amount} ANNAC. Balance: {self.wallet}") | |
| return True | |
| else: | |
| print(f"{self.name} tried to spend {amount}, but only has {self.wallet}") | |
| return False | |
| def send_tokens(self, recipient, amount): | |
| if self.spend_tokens(amount): | |
| recipient.earn_tokens(amount) | |
| print(f"{self.name} sent {amount} ANNAC to {recipient.name}") | |