Skip to content
Snippets Groups Projects
Commit 087df026 authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

Minors

parent fe38baf2
No related branches found
No related tags found
No related merge requests found
......@@ -2,9 +2,9 @@
import os
import numpy as np
from PIL import Image
from parser import BLOCK_SIZE, COLUMN_VSHIFT, MIN_COLUMN_VAL, MIN_COLUMN_SAT, \
detect_blocks, detect_exa, detect_held, print_board, \
detect_columns
from parse import BLOCK_SIZE, COLUMN_VSHIFT, MIN_COLUMN_VAL, MIN_COLUMN_SAT, \
detect_blocks, detect_exa, detect_held, print_board, \
detect_columns
from strategy import State
......@@ -33,11 +33,10 @@ def make_bitmap(board):
if __name__ == '__main__':
import sys
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.crop((0, 0, board.width, detect_columns(board))).show()
state = State.detect(board)
blocks = list(detect_blocks(board))
exa = detect_exa(board)
held = detect_held(board, exa)
......
......@@ -24,7 +24,6 @@ MAX_SPEED_ROWS = 3
class State:
def __init__(self, blocks, exa, held):
assert exa is not None
self.blocks = blocks
self.exa = exa
self.held = held
......@@ -295,6 +294,8 @@ class State:
yield mov1 + get + mov2 + put
def solve(self):
assert self.exa is not None
if self.held != NOBLOCK:
return (DROP,)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment