Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
exapunks-hackmatch-bot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
exapunks-hackmatch-bot
Commits
cf20c98e
Commit
cf20c98e
authored
5 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Make detectable board higher
parent
5fba1b44
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parse.py
+12
-9
12 additions, 9 deletions
parse.py
with
12 additions
and
9 deletions
parse
r
.py
→
parse.py
+
12
−
9
View file @
cf20c98e
...
...
@@ -6,12 +6,13 @@ COLUMNS = 7
BLOCK_SIZE
=
60
MAX_COLUMN_HEIGHT
=
546
DETECT_COLUMN_OFFSET_X
=
8
,
50
DETECT_COLUMN_OFFSET_Y
=
-
11
DETECT_COLUMN_OFFSET_X
=
9
,
49
DETECT_COLUMN_OFFSET_Y
=
11
MIN_COLUMN_SAT
=
130
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
)
BOMB_OFFSET
=
NOBLOCK
+
1
...
...
@@ -58,14 +59,14 @@ def detect_columns(board):
h
,
s
,
v
=
board
.
getpixel
((
x
,
y
))
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
):
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)
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
):
...
...
@@ -92,7 +93,8 @@ def detect_block_type(board, x, y):
def
detect_blocks
(
board
):
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
):
x
=
col
*
BLOCK_SIZE
yield
detect_block_type
(
board
,
x
,
y
+
COLUMN_VSHIFT
[
col
])
...
...
@@ -127,7 +129,8 @@ def print_board(blocks, exa, held):
if
exa
is
not
None
:
print
(
'
'
*
exa
+
'
|
'
)
print
(
'
'
,
'
-
'
*
(
exa
-
1
),
'
(
'
,
'
rpgby RPGBY
'
[
held
],
'
)
'
,
print
(
'
'
*
int
(
exa
>
0
),
'
-
'
*
(
exa
-
1
),
'
(
'
,
'
rpgby RPGBY
'
[
held
],
'
)
'
,
'
-
'
*
(
COLUMNS
-
exa
-
2
),
sep
=
''
)
...
...
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