我尝试从该函数返回数字,但出现此错误:
action= action(playerRect, baddies)
TypeError: 'int' object is not callable
代码:
action= action(playerRect, baddies)
功能:
def action(p,baddies):
epsilon = 0.9
EPS_DECAY = 0.9998
stats=makestats(p,baddies)
with open('q.pickle', 'rb') as handle:
q_table = pickle.load(handle)
if np.random.random() > epsilon:
action=np.argmax(q_table[stats])
else:
action = np.random.randint(0, 3)
epsilon *= EPS_DECAY
print(action)
return action
我该如何解决? 感谢您的帮助!