evolution-sandbo / shared_memory.py
Pasmada's picture
Upload 5 files
c313e18 verified
Raw History Blame Contribute Delete
498 Bytes
class MemoryStore:
def __init__(self):
self.records = {}
self.score_history = {}
def store(self, agent, expr, score):
if agent not in self.records or self.records[agent]['score'] < score:
self.records[agent] = {'expression': expr, 'score': score}
if agent not in self.score_history:
self.score_history[agent] = []
self.score_history[agent].append(score)
def get(self, agent):
return self.records.get(agent, None)