forked from s444420/AL-2020
string code
This commit is contained in:
parent
e1eab58672
commit
54c0d48184
13
board.py
13
board.py
@ -8,9 +8,16 @@ shelfs_o = []
|
||||
|
||||
def create_board(screen):
|
||||
board = []
|
||||
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, 650), (250, 750), (450, 650), (450, 750), (650, 650), (650, 750), (850, 650), (850, 750)]
|
||||
# # 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, 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):
|
||||
row = []
|
||||
|
2
coder.py
2
coder.py
@ -64,7 +64,7 @@ def code_shape(shape):
|
||||
|
||||
def create_image(product):
|
||||
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)
|
||||
img = Image.new('RGB', (560, 112), color='white')
|
||||
d = ImageDraw.Draw(img)
|
||||
|
36
data.py
36
data.py
@ -54,31 +54,31 @@ learning_data = [
|
||||
['white', 'rectangle', 25, 'small', 'Duplo'],
|
||||
['brown', 'jar', 500, 'big', 'GoOn'],
|
||||
['brown', 'jar', 470, 'big', 'Active Orzechowe'],
|
||||
['red', 'jar', 250, 'medium', 'Strawberry Jam'],
|
||||
['black', 'jar', 250, 'medium', 'Blackberry Jam'],
|
||||
['orange', 'jar', 250, 'medium', 'Peach Jam'],
|
||||
['brown', 'rectangle', 140, 'big', 'Jezyki classic'],
|
||||
['blue', 'rectangle', 140, 'big', 'Jezyki kokos'],
|
||||
['white', 'rectangle', 100, 'big', 'Kinder Chocolate'],
|
||||
['red', 'jar', 250, 'medium', 'Strawberry-Jam'],
|
||||
['black', 'jar', 250, 'medium', 'Blackberry-Jam'],
|
||||
['orange', 'jar', 250, 'medium', 'Peach-Jam'],
|
||||
['brown', 'rectangle', 140, 'big', 'Jezyki-classic'],
|
||||
['blue', 'rectangle', 140, 'big', 'Jezyki-kokos'],
|
||||
['white', 'rectangle', 100, 'big', 'Kinder-Chocolate'],
|
||||
['yellow', 'rectangle', 300, 'big', 'belVita'],
|
||||
['blue', 'rectangle', 380, 'big', 'Wedel-Ptasie Mleczko'],
|
||||
['purple', 'rectangle', 330, 'big', 'Milka-Alpejskie Mleczko'],
|
||||
['blue', 'rectangle', 380, 'big', 'Wedel-Ptasie-Mleczko'],
|
||||
['purple', 'rectangle', 330, 'big', 'Milka-Alpejskie-Mleczko'],
|
||||
['blue', 'rectangle', 294, 'big', 'Delicje'],
|
||||
['silver', 'pack', 280, 'big', 'Wawel-Michalki'],
|
||||
['red', 'rectangle', 50, 'medium', 'Krakuski Petit Beurre'],
|
||||
['white', 'egg', 20, 'small', 'Kinder Niespodzianka'],
|
||||
['brown', 'rectangle', 180, 'big', 'Familijne Wafle'],
|
||||
['red', 'rectangle', 235, 'big', 'dr Gerard PryncyPałki'],
|
||||
['white', 'rectangle', 25, 'medium', 'Nestlé Cini Minis Batonik'],
|
||||
['black', 'pack', 70, 'big', 'Korsarz Draże'],
|
||||
['red', 'rectangle', 50, 'medium', 'Krakuski-Petit-Beurre'],
|
||||
['white', 'egg', 20, 'small', 'Kinder-Niespodzianka'],
|
||||
['brown', 'rectangle', 180, 'big', 'Familijne-Wafle'],
|
||||
['red', 'rectangle', 235, 'big', 'dr-Gerard-PryncyPalki'],
|
||||
['white', 'rectangle', 25, 'medium', 'Nestle-Cini-Minis-Batonik'],
|
||||
['black', 'pack', 70, 'big', 'Korsarz-Draze'],
|
||||
['white', 'rectangle', 50, 'medium', 'Góralki'],
|
||||
['white', 'rectangle', 24, 'medium', 'Kinder Country'],
|
||||
['white', 'rectangle', 24, 'medium', 'Kinder-Country'],
|
||||
['red', 'rectangle', 46, 'medium', '3Bit'],
|
||||
['yellow', 'rectangle', 25, 'medium', 'Nestlé Nesquik Batonik'],
|
||||
['yellow', 'rectangle', 47, 'medium', 'Wedel WW'],
|
||||
['yellow', 'rectangle', 25, 'medium', 'Nestle-Nesquik-Batonik'],
|
||||
['yellow', 'rectangle', 47, 'medium', 'Wedel-WW'],
|
||||
['brown', 'rectangle', 30, 'medium', 'Lubisie'],
|
||||
['purple', 'rectangle', 22, 'small', 'Maoam'],
|
||||
['brown', 'rectangle', 294, 'medium', 'Grześki'],
|
||||
['brown', 'rectangle', 294, 'medium', 'Grzeski'],
|
||||
['white', 'rectangle', 250, 'big', 'merci'],
|
||||
]
|
||||
|
||||
|
7
main.py
7
main.py
@ -20,12 +20,14 @@ def run():
|
||||
settings = Settings()
|
||||
screen = pygame.display.set_mode((settings.screen_width, settings.screen_height))
|
||||
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)
|
||||
my_tree = decision_tree.build_tree(data.learning_data)
|
||||
products_from_supply = []
|
||||
supply_depot = board[9][0]
|
||||
|
||||
dest_field = None
|
||||
path = []
|
||||
next_step = None
|
||||
# Rozpoczęcie głównej pętli programu
|
||||
@ -85,6 +87,9 @@ def run():
|
||||
next_step = path.pop(len(path) - 1)
|
||||
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:
|
||||
time.sleep(0.5)
|
||||
|
Loading…
Reference in New Issue
Block a user