本文整理匯總了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()