Machine_learning_2023/domain/world.py
2023-03-28 20:14:23 +02:00

20 lines
501 B
Python

from domain.entity import Entity
from domain.vacuum import Vacuum
class World:
def __init__(self, width: int, height: int):
self.width = width
self.height = height
self.grid = [
[[] for j in range(height)] for i in range(width)
]
self.entities = []
self.cleaner = Vacuum(0, 0)
self.add(self.cleaner)
def add(self, entity: Entity):
self.entities.append(entity)
self.grid[entity.x][entity.y].append(entity)