Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
da35fbc7
Commit
da35fbc7
authored
Aug 03, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3 fixes for benchmark
parent
857dddb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Demos/benchmarks/meteor_contest.py
Demos/benchmarks/meteor_contest.py
+8
-8
No files found.
Demos/benchmarks/meteor_contest.py
View file @
da35fbc7
...
@@ -26,7 +26,7 @@ def flip(ido, fd={E: E, NE: SE, NW: SW, W: W, SW: NW, SE: NE}):
...
@@ -26,7 +26,7 @@ def flip(ido, fd={E: E, NE: SE, NW: SW, W: W, SW: NW, SE: NE}):
def
permute
(
ido
,
r_ido
):
def
permute
(
ido
,
r_ido
):
ps
=
[
ido
]
ps
=
[
ido
]
for
r
in
x
range
(
dir_no
-
1
):
for
r
in
range
(
dir_no
-
1
):
ps
.
append
(
rotate
(
ps
[
-
1
]))
ps
.
append
(
rotate
(
ps
[
-
1
]))
if
ido
==
r_ido
:
# C2-symmetry
if
ido
==
r_ido
:
# C2-symmetry
ps
=
ps
[
0
:
dir_no
//
2
]
ps
=
ps
[
0
:
dir_no
//
2
]
...
@@ -44,7 +44,7 @@ def convert(ido):
...
@@ -44,7 +44,7 @@ def convert(ido):
def
get_footprints
(
board
,
cti
,
pieces
):
def
get_footprints
(
board
,
cti
,
pieces
):
fps
=
[[[]
for
p
in
xrange
(
len
(
pieces
))]
for
ci
in
x
range
(
len
(
board
))]
fps
=
[[[]
for
p
in
range
(
len
(
pieces
))]
for
ci
in
range
(
len
(
board
))]
for
c
in
board
:
for
c
in
board
:
for
pi
,
p
in
enumerate
(
pieces
):
for
pi
,
p
in
enumerate
(
pieces
):
for
pp
in
p
:
for
pp
in
p
:
...
@@ -64,8 +64,8 @@ def get_senh(board, cti):
...
@@ -64,8 +64,8 @@ def get_senh(board, cti):
def
get_puzzle
(
w
=
w
,
h
=
h
):
def
get_puzzle
(
w
=
w
,
h
=
h
):
board
=
[
E
*
x
+
S
*
y
+
(
y
%
2
)
for
y
in
xrange
(
h
)
for
x
in
x
range
(
w
)]
board
=
[
E
*
x
+
S
*
y
+
(
y
%
2
)
for
y
in
range
(
h
)
for
x
in
range
(
w
)]
cti
=
dict
((
board
[
i
],
i
)
for
i
in
x
range
(
len
(
board
)))
cti
=
dict
((
board
[
i
],
i
)
for
i
in
range
(
len
(
board
)))
idos
=
[[
E
,
E
,
E
,
SE
],
# incremental direction offsets
idos
=
[[
E
,
E
,
E
,
SE
],
# incremental direction offsets
[
SE
,
SW
,
W
,
SW
],
[
SE
,
SW
,
W
,
SW
],
...
@@ -84,8 +84,8 @@ def get_puzzle(w=w, h=h):
...
@@ -84,8 +84,8 @@ def get_puzzle(w=w, h=h):
def
print_board
(
board
,
w
=
w
,
h
=
h
):
def
print_board
(
board
,
w
=
w
,
h
=
h
):
for
y
in
x
range
(
h
):
for
y
in
range
(
h
):
for
x
in
x
range
(
w
):
for
x
in
range
(
w
):
print
(
board
[
x
+
y
*
w
])
print
(
board
[
x
+
y
*
w
])
print
(
''
)
print
(
''
)
if
y
%
2
==
0
:
if
y
%
2
==
0
:
...
@@ -131,9 +131,9 @@ SOLVE_ARG = 60
...
@@ -131,9 +131,9 @@ SOLVE_ARG = 60
def
main
(
n
):
def
main
(
n
):
times
=
[]
times
=
[]
for
i
in
x
range
(
n
):
for
i
in
range
(
n
):
t0
=
time
.
time
()
t0
=
time
.
time
()
free
=
frozenset
(
x
range
(
len
(
board
)))
free
=
frozenset
(
range
(
len
(
board
)))
curr_board
=
[
-
1
]
*
len
(
board
)
curr_board
=
[
-
1
]
*
len
(
board
)
pieces_left
=
list
(
range
(
len
(
pieces
)))
pieces_left
=
list
(
range
(
len
(
pieces
)))
solutions
=
[]
solutions
=
[]
...
...
Write
Preview
Markdown
is supported
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