Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guillaume CLOCHARD
Ragnulf
Commits
cdfe5697
Commit
cdfe5697
authored
Jan 13, 2016
by
Guillaume CLOCHARD
Browse files
Fix JEU_TEST
parent
7a14c083
Changes
1
Hide whitespace changes
Inline
Side-by-side
temps.py
View file @
cdfe5697
import
time
import
time
import
json
from
Cube
import
*
from
algo
import
algo_cfop
from
lire_entree
import
lecture_cube
from
stats
import
*
JEU_TEST
=
'tests/samples/liste-sample.json'
DEFAULT_CUBE
=
'OGRBWYBGBGYYOYOWOWGRYOOOBGBRRYRBWWWRBWYGROWGRYBRGYWBOG'
# Renvois le temps d'éxecution du cube test donné dans poqb.py
def
getTimeDefaultCube
():
tmps1
=
time
.
clock
()
DEFAULT_CUBE
=
'OGRBWYBGBGYYOYOWOWGRYOOOBGBRRYRBWWWRBWYGROWGRYBRGYWBOG'
b
,
c
=
lecture_cube
(
DEFAULT_CUBE
)
b
,
c
=
lecture_cube
(
DEFAULT_CUBE
)
c
,
mouv
=
algo_cfop
(
c
)
# on fais l'algo
tmps2
=
time
.
clock
()
return
tmps2
-
tmps1
# Renvois dans une liste le temps d'éxecution des 11400 cubes
def
getTimes11400Cubes
():
JEU_TEST
=
'tests/samples/sample-600.json'
def
getTimes11400Cubes
():
liste
=
[]
with
open
(
JEU_TEST
)
as
data_file
:
#on parse le jeu de test JSON
data
=
json
.
load
(
data_file
)
tests
=
data
[
"cubes"
]
for
test
in
tests
:
# on parcours tout les cubes
tmps1
=
time
.
clock
()
b
,
c
=
lecture_cube
(
test
)
b
,
c
=
lecture_cube
(
test
)
c
,
mouv
=
algo_cfop
(
c
)
# on fais l'algo
tmps2
=
time
.
clock
()
tmps2
=
time
.
clock
()
liste
.
append
(
tmps2
-
tmps1
)
return
liste
liste
=
getTimes11400Cubes
()
print
(
"Temps éxecution cube test : "
+
str
(
getTimeDefaultCube
())
+
"s"
)
# cube test
print
(
"Temps éxecution cube test : "
+
str
(
getTimeDefaultCube
())
+
"s"
)
# cube test
print
(
"Temps éxecution 11400 cubes : "
+
str
(
sum
(
liste
))
+
"s"
)
print
(
"Moyenne d'éxecution de 11400 cubes : "
+
str
(
moyenne
(
liste
))
+
"s"
)
print
(
"Écart type 11400 cubes : "
+
str
(
ecart_type
(
liste
))
+
"s"
)
\ No newline at end of file
print
(
"Écart type 11400 cubes : "
+
str
(
ecart_type
(
liste
))
+
"s"
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment