Closed CreeperLove3000 closed 3 years ago
What exactly are you expecting as an output? Memory is None
until you feed a value into it from with a return.
If you meant history, what way would you want it to output?
If you want to store a dictionary in 'memory', don't forget that you have to instantiate it yourself! You also have make sure that dictionary can be read in as parameter, and is being outputted as well.
Here's a simple example of "grimTrigger" written with a dictionary in 'memory':
def strategy(history, memory):
nextMemory = None
if memory is not None:
nextMemory = memory
else:
nextMemory = {}
nextMemory['whatIHadForBreakfast'] = "eggs"
nextMemory['wasIWronged'] = False
if history.shape[1] >= 1 and history[1,-1] == 0: # Just got wronged.
nextMemory['wasIWronged'] = True
choice = 0 if nextMemory['wasIWronged'] else 1
return choice, nextMemory
I'm trying to output memory as a dictionary but memory is staying as a None value, does this mean that memory can't be a dictionary and how can I fix it?