Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2048
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wen Yao Jin
2048
Commits
2117f59c
Commit
2117f59c
authored
Mar 7, 2017
by
Wen Yao Jin
Browse files
Options
Downloads
Patches
Plain Diff
go
parent
67bc4074
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
puzzle.py
+8
-4
8 additions, 4 deletions
puzzle.py
train_history_after_1.txt
+1
-0
1 addition, 0 deletions
train_history_after_1.txt
with
9 additions
and
4 deletions
puzzle.py
+
8
−
4
View file @
2117f59c
...
@@ -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
))
This diff is collapsed.
Click to expand it.
train_history_after_1.txt
0 → 100644
+
1
−
0
View file @
2117f59c
1.280000000000000000e+02
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment