Skip to content
Snippets Groups Projects
Commit 2117f59c authored by Wen Yao Jin's avatar Wen Yao Jin
Browse files

go

parent 67bc4074
No related branches found
No related tags found
No related merge requests found
...@@ -8,8 +8,10 @@ from random import * ...@@ -8,8 +8,10 @@ from random import *
from agent import * from agent import *
import numpy as np import numpy as np
import pickle import pickle
import time
TRAIN = 5000
TRAIN = 20000
SIZE = 500 SIZE = 500
GRID_LEN = 4 GRID_LEN = 4
GRID_PADDING = 10 GRID_PADDING = 10
...@@ -120,9 +122,9 @@ class GameGrid(Frame): ...@@ -120,9 +122,9 @@ class GameGrid(Frame):
if (game_state(self.matrix)=='win' ) or (game_state(self.matrix)=='lose'): if (game_state(self.matrix)=='win' ) or (game_state(self.matrix)=='lose'):
# print(self.agent.W) # print(self.agent.W)
if (self.count == TRAIN): if (self.count == TRAIN):
# f = open("train_result_after_"+str(TRAIN)+".txt",'wb') f = open("train_result_after_"+str(TRAIN)+".txt",'wb')
# pickle.dump(self.agent.W ,f) pickle.dump(self.agent.W ,f)
# f.close() f.close()
f = open("train_history_after_"+str(TRAIN)+".txt",'wb') f = open("train_history_after_"+str(TRAIN)+".txt",'wb')
np.savetxt(f, self.history) np.savetxt(f, self.history)
f.close() f.close()
...@@ -146,4 +148,6 @@ class GameGrid(Frame): ...@@ -146,4 +148,6 @@ class GameGrid(Frame):
index = (self.gen(), self.gen()) index = (self.gen(), self.gen())
self.matrix[index[0]][index[1]] = 2 self.matrix[index[0]][index[1]] = 2
start_time = time.time()
gamegrid = GameGrid() gamegrid = GameGrid()
print("--- %s seconds ---" % (time.time() - start_time))
1.280000000000000000e+02
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment