Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
exapunks-hackmatch-bot
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
exapunks-hackmatch-bot
Commits
087df026
Commit
087df026
authored
Apr 08, 2020
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minors
parent
fe38baf2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
analyze.py
analyze.py
+4
-5
strategy.py
strategy.py
+2
-1
No files found.
analyze.py
View file @
087df026
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
import
os
import
os
import
numpy
as
np
import
numpy
as
np
from
PIL
import
Image
from
PIL
import
Image
from
parse
r
import
BLOCK_SIZE
,
COLUMN_VSHIFT
,
MIN_COLUMN_VAL
,
MIN_COLUMN_SAT
,
\
from
parse
import
BLOCK_SIZE
,
COLUMN_VSHIFT
,
MIN_COLUMN_VAL
,
MIN_COLUMN_SAT
,
\
detect_blocks
,
detect_exa
,
detect_held
,
print_board
,
\
detect_blocks
,
detect_exa
,
detect_held
,
print_board
,
\
detect_columns
detect_columns
from
strategy
import
State
from
strategy
import
State
...
@@ -33,11 +33,10 @@ def make_bitmap(board):
...
@@ -33,11 +33,10 @@ def make_bitmap(board):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
sys
import
sys
ident
=
int
(
sys
.
argv
[
1
])
ident
=
int
(
sys
.
argv
[
1
])
extensive
=
sys
.
argv
[
2
]
==
'y'
if
len
(
sys
.
argv
)
>
2
else
False
extensive
=
len
(
sys
.
argv
)
>
2
and
sys
.
argv
[
2
]
==
'y'
board
=
Image
.
open
(
'screens/board%d.png'
%
ident
).
convert
(
'HSV'
)
board
=
Image
.
open
(
'screens/board%d.png'
%
ident
).
convert
(
'HSV'
)
#board.crop((0, 0, board.width, detect_columns(board))).show()
#board.crop((0, 0, board.width, detect_columns(board))).show()
state
=
State
.
detect
(
board
)
blocks
=
list
(
detect_blocks
(
board
))
blocks
=
list
(
detect_blocks
(
board
))
exa
=
detect_exa
(
board
)
exa
=
detect_exa
(
board
)
held
=
detect_held
(
board
,
exa
)
held
=
detect_held
(
board
,
exa
)
...
...
strategy.py
View file @
087df026
...
@@ -24,7 +24,6 @@ MAX_SPEED_ROWS = 3
...
@@ -24,7 +24,6 @@ MAX_SPEED_ROWS = 3
class
State
:
class
State
:
def
__init__
(
self
,
blocks
,
exa
,
held
):
def
__init__
(
self
,
blocks
,
exa
,
held
):
assert
exa
is
not
None
self
.
blocks
=
blocks
self
.
blocks
=
blocks
self
.
exa
=
exa
self
.
exa
=
exa
self
.
held
=
held
self
.
held
=
held
...
@@ -295,6 +294,8 @@ class State:
...
@@ -295,6 +294,8 @@ class State:
yield
mov1
+
get
+
mov2
+
put
yield
mov1
+
get
+
mov2
+
put
def
solve
(
self
):
def
solve
(
self
):
assert
self
.
exa
is
not
None
if
self
.
held
!=
NOBLOCK
:
if
self
.
held
!=
NOBLOCK
:
return
(
DROP
,)
return
(
DROP
,)
...
...
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