sztuczna_inteligencja_2023_.../landfill.py
2023-05-11 20:12:41 +02:00

39 lines
1.3 KiB
Python

from typing import Tuple
from gameContext import GameContext
from garbage import RecognizedGarbage
from gridCellType import GridCellType
class Landfill:
position: Tuple[int, int] = []
paper: list[RecognizedGarbage]
plastic_and_metal: list[RecognizedGarbage] = []
glass: list[RecognizedGarbage] = []
bio: list[RecognizedGarbage] = []
mixed: list[RecognizedGarbage] = []
def __init__(self, position: Tuple[int, int]) -> None:
self.position = position
def add_paper(self, paper: list[RecognizedGarbage]) -> None:
for p in paper:
self.paper.append(p)
def add_plastic_and_metal(self, plastic_and_metal: list[RecognizedGarbage]) -> None:
for p in plastic_and_metal:
self.plastic_and_metal.append(p)
def add_glass(self, glass: list[RecognizedGarbage]) -> None:
for g in glass:
self.glass.append(g)
def add_paper(self, bio: list[RecognizedGarbage]) -> None:
for b in bio:
self.bio.append(b)
def add_mixed(self, mixed: list[RecognizedGarbage]) -> None:
for m in mixed:
self.mixed.append(m)
def render(self, game_context: GameContext) -> None:
game_context.render_in_cell(self.position, 'imgs/landfill.png')
game_context.grid[self.position] = GridCellType.LANDFILL