ogarnia co gdzie polozyc

This commit is contained in:
shaaqu 2020-06-09 23:23:49 +02:00
parent 2b1b66f3b3
commit 1864443980
3 changed files with 8 additions and 8 deletions

View File

@ -5,14 +5,14 @@ from codes_recognizer.rocognizer import recognizer
def assigning(product_code_path, shelfs): def assigning(product_code_path, shelfs):
c = None c = None
code = recognizer(product_code_path) code = product_code_path
print(code) # code = recognizer(product_code_path)
product_color = str(code[0]) + str(code[1]) product_color = str(code[0]) + str(code[1])
print(product_color)
for shelf in shelfs: for shelf in shelfs:
if shelf.color == product_color: if shelf.color == product_color:
shelf.add_product(code) shelf.add_product(code)
c = shelf.get_field() c = shelf.get_field()
print("Product", product_code_path, "is on", c)
print("Product:", product_code_path, "is on", c.x, c.y)
return c return c

View File

@ -72,5 +72,5 @@ def create_image(product):
d.text((28, 28), string, font=fnt, fill=(0, 0, 0)) d.text((28, 28), string, font=fnt, fill=(0, 0, 0))
path = 'img/codes/' + product.name + '.png' path = 'img/codes/' + product.name + '.png'
img.save(path) img.save(path)
return path return string

View File

@ -79,13 +79,13 @@ def run():
''' '''
# list [x, y] # list [x, y]
dest_shelf = new_product.shelf(shelfs) dest_shelf = new_product.shelf(shelfs)
path = functions.a_star(board[agent.y][agent.x], dest_shelf.get_field(), board) path = functions.a_star(board[agent.y][agent.x], dest_shelf, board)
'''''' ''''''
agent.item = new_product agent.item = new_product
path.pop(len(path) - 1) # path.pop(len(path) - 1)
next_step = path.pop(len(path) - 1) next_step = path.pop(len(path) - 1)
agent.is_busy = True # agent.is_busy = True
if board[agent.y][agent.x] == dest_field: if board[agent.y][agent.x] == dest_field:
agent.is_busy = False agent.is_busy = False