本文整理汇总了Python中SwingyMonkey.SwingyMonkey.get_score方法的典型用法代码示例。如果您正苦于以下问题:Python SwingyMonkey.get_score方法的具体用法?Python SwingyMonkey.get_score怎么用?Python SwingyMonkey.get_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SwingyMonkey.SwingyMonkey
的用法示例。
在下文中一共展示了SwingyMonkey.get_score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Learner
# 需要导入模块: from SwingyMonkey import SwingyMonkey [as 别名]
# 或者: from SwingyMonkey.SwingyMonkey import get_score [as 别名]
iters = 150
learner = Learner()
scores = []
for ii in xrange(iters):
# Make a new monkey object.
swing = SwingyMonkey(sound=False, # Don't play sounds.
text="Epoch %d" % (ii), # Display the epoch on screen.
tick_length=1, # Make game ticks super fast.
action_callback=learner.action_callback,
reward_callback=learner.reward_callback)
# Loop until you hit something.
while swing.game_loop():
pass
scores.append(swing.get_score())
# Reset the state of the learner.
learner.reset()
domain = np.arange(1, iters + 1, 1)
plt.plot(domain, scores)
plt.title("Scores over each Epoch (discount = " + str(learner.discount) + ")")
plt.xlabel("Epoch")
plt.ylabel("Score")
plt.savefig("scores.png")
plt.show()