nowe shelfy kolorowe wziuuu #10

Merged
s444428 merged 10 commits from s444428/AL-2020:master into master 2020-06-09 22:56:57 +02:00
4 changed files with 35 additions and 23 deletions
Showing only changes of commit 54c0d48184 - Show all commits

View File

@ -8,9 +8,16 @@ shelfs_o = []
def create_board(screen): def create_board(screen):
board = [] board = []
shelfs = [(250, 150), (250, 250), (450, 150), (450, 250), (650, 150), (650, 250), (850, 150), (850, 250), # # shelfs = [(250, 150), (250, 250), (450, 150), (450, 250), (650, 150), (650, 250), (850, 150), (850, 250),
(250, 450), (350, 450), (750, 450), (850, 450), # (250, 450), (350, 450), (750, 450), (850, 450),
(250, 650), (250, 750), (450, 650), (450, 750), (650, 650), (650, 750), (850, 650), (850, 750)] # (250, 650), (250, 750), (450, 650), (450, 750), (650, 650), (650, 750), (850, 650), (850, 750)]
shelfs = [
(50, 50), (150, 50), (450, 50), (550, 50), (850, 50), (950, 50),
(250, 250), (350, 250), (650, 250), (750, 250),
(50, 450), (150, 450), (450, 450), (550, 450), (850, 450), (950, 450),
(250, 650), (350, 650), (650, 650), (750, 650),
]
for y in range(settings.y_fields): for y in range(settings.y_fields):
row = [] row = []

View File

@ -64,7 +64,7 @@ def code_shape(shape):
def create_image(product): def create_image(product):
string = code_color(product.color) + code_shape(product.shape) + code_mass(product.mass) + \ string = code_color(product.color) + code_shape(product.shape) + code_mass(product.mass) + \
code_shape(product.shape) + code_price(product.price) code_size(product.size) + code_price(product.price)
print(string) print(string)
img = Image.new('RGB', (560, 112), color='white') img = Image.new('RGB', (560, 112), color='white')
d = ImageDraw.Draw(img) d = ImageDraw.Draw(img)

36
data.py
View File

@ -54,31 +54,31 @@ learning_data = [
['white', 'rectangle', 25, 'small', 'Duplo'], ['white', 'rectangle', 25, 'small', 'Duplo'],
['brown', 'jar', 500, 'big', 'GoOn'], ['brown', 'jar', 500, 'big', 'GoOn'],
['brown', 'jar', 470, 'big', 'Active Orzechowe'], ['brown', 'jar', 470, 'big', 'Active Orzechowe'],
['red', 'jar', 250, 'medium', 'Strawberry Jam'], ['red', 'jar', 250, 'medium', 'Strawberry-Jam'],
['black', 'jar', 250, 'medium', 'Blackberry Jam'], ['black', 'jar', 250, 'medium', 'Blackberry-Jam'],
['orange', 'jar', 250, 'medium', 'Peach Jam'], ['orange', 'jar', 250, 'medium', 'Peach-Jam'],
['brown', 'rectangle', 140, 'big', 'Jezyki classic'], ['brown', 'rectangle', 140, 'big', 'Jezyki-classic'],
['blue', 'rectangle', 140, 'big', 'Jezyki kokos'], ['blue', 'rectangle', 140, 'big', 'Jezyki-kokos'],
['white', 'rectangle', 100, 'big', 'Kinder Chocolate'], ['white', 'rectangle', 100, 'big', 'Kinder-Chocolate'],
['yellow', 'rectangle', 300, 'big', 'belVita'], ['yellow', 'rectangle', 300, 'big', 'belVita'],
['blue', 'rectangle', 380, 'big', 'Wedel-Ptasie Mleczko'], ['blue', 'rectangle', 380, 'big', 'Wedel-Ptasie-Mleczko'],
['purple', 'rectangle', 330, 'big', 'Milka-Alpejskie Mleczko'], ['purple', 'rectangle', 330, 'big', 'Milka-Alpejskie-Mleczko'],
['blue', 'rectangle', 294, 'big', 'Delicje'], ['blue', 'rectangle', 294, 'big', 'Delicje'],
['silver', 'pack', 280, 'big', 'Wawel-Michalki'], ['silver', 'pack', 280, 'big', 'Wawel-Michalki'],
['red', 'rectangle', 50, 'medium', 'Krakuski Petit Beurre'], ['red', 'rectangle', 50, 'medium', 'Krakuski-Petit-Beurre'],
['white', 'egg', 20, 'small', 'Kinder Niespodzianka'], ['white', 'egg', 20, 'small', 'Kinder-Niespodzianka'],
['brown', 'rectangle', 180, 'big', 'Familijne Wafle'], ['brown', 'rectangle', 180, 'big', 'Familijne-Wafle'],
['red', 'rectangle', 235, 'big', 'dr Gerard PryncyPałki'], ['red', 'rectangle', 235, 'big', 'dr-Gerard-PryncyPalki'],
['white', 'rectangle', 25, 'medium', 'Nestlé Cini Minis Batonik'], ['white', 'rectangle', 25, 'medium', 'Nestle-Cini-Minis-Batonik'],
['black', 'pack', 70, 'big', 'Korsarz Draże'], ['black', 'pack', 70, 'big', 'Korsarz-Draze'],
['white', 'rectangle', 50, 'medium', 'Góralki'], ['white', 'rectangle', 50, 'medium', 'Góralki'],
['white', 'rectangle', 24, 'medium', 'Kinder Country'], ['white', 'rectangle', 24, 'medium', 'Kinder-Country'],
['red', 'rectangle', 46, 'medium', '3Bit'], ['red', 'rectangle', 46, 'medium', '3Bit'],
['yellow', 'rectangle', 25, 'medium', 'Nestlé Nesquik Batonik'], ['yellow', 'rectangle', 25, 'medium', 'Nestle-Nesquik-Batonik'],
['yellow', 'rectangle', 47, 'medium', 'Wedel WW'], ['yellow', 'rectangle', 47, 'medium', 'Wedel-WW'],
['brown', 'rectangle', 30, 'medium', 'Lubisie'], ['brown', 'rectangle', 30, 'medium', 'Lubisie'],
['purple', 'rectangle', 22, 'small', 'Maoam'], ['purple', 'rectangle', 22, 'small', 'Maoam'],
['brown', 'rectangle', 294, 'medium', 'Grześki'], ['brown', 'rectangle', 294, 'medium', 'Grzeski'],
['white', 'rectangle', 250, 'big', 'merci'], ['white', 'rectangle', 250, 'big', 'merci'],
] ]

View File

@ -20,12 +20,14 @@ def run():
settings = Settings() settings = Settings()
screen = pygame.display.set_mode((settings.screen_width, settings.screen_height)) screen = pygame.display.set_mode((settings.screen_width, settings.screen_height))
pygame.display.set_caption("Inteligentny wózek widłowy") pygame.display.set_caption("Inteligentny wózek widłowy")
agent = Agent(screen, 550, 450, "Down") # agent = Agent(screen, 550, 450, "Down")
agent = Agent(screen, 950, 950, "Left")
board = create_board(screen) board = create_board(screen)
my_tree = decision_tree.build_tree(data.learning_data) my_tree = decision_tree.build_tree(data.learning_data)
products_from_supply = [] products_from_supply = []
supply_depot = board[9][0] supply_depot = board[9][0]
dest_field = None
path = [] path = []
next_step = None next_step = None
# Rozpoczęcie głównej pętli programu # Rozpoczęcie głównej pętli programu
@ -85,6 +87,9 @@ def run():
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:
agent.is_busy = False
agent.item = None
if next_step is not None: if next_step is not None:
time.sleep(0.5) time.sleep(0.5)