27 lines
892 B
Python
27 lines
892 B
Python
from enum import Enum
|
|
from plansza import x1,x2,x3,x4,y1,y2,y3,y4,a,b
|
|
|
|
from typing import Tuple, Dict
|
|
|
|
class GridCellType(Enum):
|
|
FREE = 0
|
|
RACK = 1
|
|
PLACE = 2
|
|
# dodać oznaczenie na miejsce dla paczek
|
|
|
|
class SearchGrid:
|
|
grid: Dict[Tuple[int, int], GridCellType] = {}
|
|
|
|
def __init__(self) -> None:
|
|
self._init_grid()
|
|
|
|
def _init_grid(self) -> None:
|
|
for i in range (0,14):
|
|
for j in range(0,14):
|
|
self.grid[(i, j)] = GridCellType.FREE
|
|
for r, c in [(x1, y1), (x1, y1+1), (x1+1, y1), (x1+1, y1+1), (x2, y2), (x2+1, y2), (x2, y2+1), (x2+1, y2+1),
|
|
(x3, y3), (x3+1, y3), (x3, y3+1), (x3+1, y3+1), (x4, y4), (x4+1, y4), (x4, y4+1), (x4+1, y4+1),]:
|
|
self.grid[(r,c)] = GridCellType.RACK
|
|
for m, n in [(a,b), (a+1,b), (a,b+1), (a+1,b+1)]:
|
|
self.grid[(m,n)] = GridCellType.PLACE
|