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
cf20c98e
Commit
cf20c98e
authored
Apr 06, 2020
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make detectable board higher
parent
5fba1b44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
parse.py
parse.py
+12
-9
No files found.
parse
r
.py
→
parse.py
View file @
cf20c98e
...
@@ -6,12 +6,13 @@ COLUMNS = 7
...
@@ -6,12 +6,13 @@ COLUMNS = 7
BLOCK_SIZE
=
60
BLOCK_SIZE
=
60
MAX_COLUMN_HEIGHT
=
546
MAX_COLUMN_HEIGHT
=
546
DETECT_COLUMN_OFFSET_X
=
8
,
50
DETECT_COLUMN_OFFSET_X
=
9
,
49
DETECT_COLUMN_OFFSET_Y
=
-
11
DETECT_COLUMN_OFFSET_Y
=
11
MIN_COLUMN_SAT
=
130
MIN_COLUMN_SAT
=
130
MIN_COLUMN_VAL
=
120
MIN_COLUMN_VAL
=
120
COLUMN_VSHIFT
=
[
-
2
,
-
2
,
-
1
,
-
1
,
0
,
0
,
0
]
COLUMN_VSHIFT
=
[
1
,
1
,
1
,
0
,
0
,
0
,
0
]
#COLUMN_VSHIFT = [2, 2, 1, 1, 0, 0, 0]
RED
,
PINK
,
GREEN
,
BLUE
,
YELLOW
,
NOBLOCK
=
range
(
6
)
RED
,
PINK
,
GREEN
,
BLUE
,
YELLOW
,
NOBLOCK
=
range
(
6
)
BOMB_OFFSET
=
NOBLOCK
+
1
BOMB_OFFSET
=
NOBLOCK
+
1
...
@@ -58,14 +59,14 @@ def detect_columns(board):
...
@@ -58,14 +59,14 @@ def detect_columns(board):
h
,
s
,
v
=
board
.
getpixel
((
x
,
y
))
h
,
s
,
v
=
board
.
getpixel
((
x
,
y
))
return
s
>
MIN_COLUMN_SAT
and
v
>
MIN_COLUMN_VAL
return
s
>
MIN_COLUMN_SAT
and
v
>
MIN_COLUMN_VAL
a
,
b
=
DETECT_COLUMN_OFFSET_X
miny
=
-
min
(
DETECT_BASIC_Y
,
DETECT_BOMB_Y
)
for
y
in
range
(
MAX_COLUMN_HEIGHT
,
BLOCK_SIZE
,
-
1
):
for
y
in
range
(
MAX_COLUMN_HEIGHT
,
miny
+
BLOCK_SIZE
,
-
1
):
for
col
in
range
(
COLUMNS
):
for
col
in
range
(
COLUMNS
):
x
=
col
*
BLOCK_SIZE
x
=
col
*
BLOCK_SIZE
if
saturated
(
x
+
a
,
y
)
and
saturated
(
x
+
b
,
y
):
if
all
(
saturated
(
x
+
cx
,
y
)
for
cx
in
DETECT_COLUMN_OFFSET_X
):
#print('found bottom in column', col)
#print('found bottom in column', col)
return
y
+
1
-
DETECT_COLUMN_OFFSET_Y
+
COLUMN_VSHIFT
[
col
]
return
y
+
1
+
DETECT_COLUMN_OFFSET_Y
-
COLUMN_VSHIFT
[
col
]
def
detect_block_type
(
board
,
x
,
y
):
def
detect_block_type
(
board
,
x
,
y
):
...
@@ -92,7 +93,8 @@ def detect_block_type(board, x, y):
...
@@ -92,7 +93,8 @@ def detect_block_type(board, x, y):
def
detect_blocks
(
board
):
def
detect_blocks
(
board
):
maxy
=
detect_columns
(
board
)
-
BLOCK_SIZE
maxy
=
detect_columns
(
board
)
-
BLOCK_SIZE
for
y
in
range
(
maxy
,
0
,
-
BLOCK_SIZE
):
miny
=
-
min
(
DETECT_BASIC_Y
,
DETECT_BOMB_Y
)
for
y
in
range
(
maxy
,
miny
,
-
BLOCK_SIZE
):
for
col
in
range
(
COLUMNS
):
for
col
in
range
(
COLUMNS
):
x
=
col
*
BLOCK_SIZE
x
=
col
*
BLOCK_SIZE
yield
detect_block_type
(
board
,
x
,
y
+
COLUMN_VSHIFT
[
col
])
yield
detect_block_type
(
board
,
x
,
y
+
COLUMN_VSHIFT
[
col
])
...
@@ -127,7 +129,8 @@ def print_board(blocks, exa, held):
...
@@ -127,7 +129,8 @@ def print_board(blocks, exa, held):
if
exa
is
not
None
:
if
exa
is
not
None
:
print
(
' '
*
exa
+
' |'
)
print
(
' '
*
exa
+
' |'
)
print
(
' '
,
'-'
*
(
exa
-
1
),
'('
,
'rpgby RPGBY'
[
held
],
')'
,
print
(
' '
*
int
(
exa
>
0
),
'-'
*
(
exa
-
1
),
'('
,
'rpgby RPGBY'
[
held
],
')'
,
'-'
*
(
COLUMNS
-
exa
-
2
),
sep
=
''
)
'-'
*
(
COLUMNS
-
exa
-
2
),
sep
=
''
)
...
...
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