本文整理汇总了Python中Gui.gui方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.gui方法的具体用法?Python Gui.gui怎么用?Python Gui.gui使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gui
的用法示例。
在下文中一共展示了Gui.gui方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import gui [as 别名]
if r == -1:
self.restart(False)
if r == 1:
#print()
#print("goal!")
self.restart(True) # Only decay epsilon if the goal state is reached.
self.action = a
time.sleep(self.gui.getSpeed())
def load(self, fn):
loaded = pickle.load(open(fn, "rb"))
self.epsilon = loaded[-2]
self.q_table = loaded[-1]
def save(self):
saveList = [self.alpha, self.gamma, self.lamb, self.ed, self.epsilon, self.q_table]
pickle.dump(saveList, open(self.fileName, "wb"))
if __name__ == '__main__':
if len(sys.argv) < 2:
#print("Please specify name of save file")
#print()
exit(1)
fn = sys.argv[1]
world = World.loadWorld('world.txt')
gui = Gui.gui(700, world)
p = Agent(world,gui, fn, .4, .5, .4) # alpha, gamma, lambda
while True:
p.takeAction()
示例2: float
# 需要导入模块: import Gui [as 别名]
# 或者: from Gui import gui [as 别名]
a = float(sys.argv[2])
g = float(sys.argv[3])
l = float(sys.argv[4])
ed = float(sys.argv[5])
e = .9
q_table = []
for i in range(22):
q_table.append([])
for j in range(22):
q_table[i].append([])
for k in range(4):
q_table[i][j].append(np.random.rand() * .1)
else:
gui = Gui.Start()
a = gui.params[0]
g = gui.params[1]
l = gui.params[2]
ed = gui.params[3]
e = gui.params[4]
q_table = gui.params[5]
fn = gui.fn
print("here")
world = World.loadWorld('rec/world.txt')
gui = Gui.gui(1000, world)
agent = Agent.Agent(world, gui, fn, q_table, e, a, g, l, ed) # alpha, gamma, lambda, Epsilon Decay
t = threading.Thread(target=actionLoop, args=[agent])
t.start()
gui.window.mainloop()