commit 89b63b585cc656b98ea89f4aa716be0f5b920f71 Author: andrzej Date: Thu Apr 2 15:25:15 2020 +0200 Szkielet szkieletu diff --git a/agent.py b/agent.py new file mode 100644 index 0000000..305af8b --- /dev/null +++ b/agent.py @@ -0,0 +1,5 @@ + +class Forklifter: + def __init__(self, start_x, start_y): + self.x = start_x + self.y = start_y \ No newline at end of file diff --git a/attributes.py b/attributes.py new file mode 100644 index 0000000..e425ded --- /dev/null +++ b/attributes.py @@ -0,0 +1,14 @@ +from enum import Enum + +class PackSize(Enum): + ALL = 0 + SMALL = 1 + MEDIUM = 2 + LARGE = 3 + HUGE = 4 + + +PACK_CATEGORIES = { + 'general', + 'freezed', +} diff --git a/main.py b/main.py new file mode 100644 index 0000000..98ea82a --- /dev/null +++ b/main.py @@ -0,0 +1,22 @@ +import pygame +import warehouse +from attributes import PackSize + +WINDOW_SIZE = (1000, 800) +COLORS = [(255, 255, 255), (0, 0, 0)] + + +def main(): + pygame.init() + display = pygame.display.set_mode(WINDOW_SIZE) + warehouse_map = warehouse.Warehouse(50, 50) + # import pdb + # pdb.set_trace() + print(warehouse_map) + for t in warehouse_map.tiles[0][:10]: + print(t) + while True: + pygame.display.flip() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/warehouse.py b/warehouse.py new file mode 100644 index 0000000..6f665a4 --- /dev/null +++ b/warehouse.py @@ -0,0 +1,60 @@ +from attributes import PackSize +import random + +class CategoryData: + def __init__(self, name, passable=False, can_store=True, location='general', pack_size=PackSize.ALL): + self.name = name + self.passable = passable + self.can_store = can_store + self.location = location + self.pack_size = pack_size + + def __repr__(self): + return self.name + +class Pack: + def __init__(self, size, categ='general'): + self.size = size + self.category = categ + + +CATEGORY = { + 'floor': CategoryData('Floor', True, False), #lava + 'rack': CategoryData('Rack', False, True), + # 'freezer': CategoryData('Freezer', False, True, location='cold_room') +} + + +class Warehouse: + def __init__(self, width, length): + self.width = width + self.length = length + self.tiles = self.generate_map() + + def __str__(self): + return "Magazyn {}x{}".format(self.width, self.length) + + def generate_map(self): + warehouse_tiles = [] + categories = list(CATEGORY.keys()) + for x in range(self.width): + row = [Tile('floor', x, y) for y in range(self.length)] + warehouse_tiles.append(row) + + # warehouse_tiles = self.create_racks(20, warehouse_tiles) + return warehouse_tiles + + # def create_racks(self, number_of_racks=0, warehouse_tiles=[]): + + +class Tile: + def __init__(self, category, x_position, y_position): + self.category = CATEGORY.get(category, CATEGORY['floor']) + self.x_position = x_position + self.y_position = y_position + + def __str__(self): + return "Tile type: {} on position ({},{})".format(self.category, self.x_position, self.y_position) + + def __repr__(self): + return "Tile type: {} on position ({},{})".format(self.category, self.x_position, self.y_position) \ No newline at end of file