本文整理汇总了Python中World.set_cell_score方法的典型用法代码示例。如果您正苦于以下问题:Python World.set_cell_score方法的具体用法?Python World.set_cell_score怎么用?Python World.set_cell_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.set_cell_score方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: inc_Q
# 需要导入模块: import World [as 别名]
# 或者: from World import set_cell_score [as 别名]
def inc_Q(s, a, alpha, inc):
Q[s][a] *= 1 - alpha
Q[s][a] += alpha * inc
World.set_cell_score(s, a, Q[s][a])
示例2: range
# 需要导入模块: import World [as 别名]
# 或者: from World import set_cell_score [as 别名]
import threading
import time
discount = 0.3
actions = World.actions
states = []
Q = {}
for i in range(World.x):
for j in range(World.y):
states.append((i, j))
for state in states:
temp = {}
for action in actions:
temp[action] = 0.1
World.set_cell_score(state, action, temp[action])
Q[state] = temp
for (i, j, c, w) in World.specials:
for action in actions:
Q[(i, j)][action] = w
World.set_cell_score((i, j), action, w)
def do_action(action):
s = World.player
r = -World.score
if action == actions[0]:
World.try_move(0, -1)
elif action == actions[1]:
World.try_move(0, 1)