auto formatting

This commit is contained in:
Mateusz Dokowicz 2023-03-30 18:27:51 +02:00
parent 291e028a8a
commit f7b97c5f74
4 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,3 @@
class Command: class Command:
def run(self): def run(self):
raise NotImplementedError() raise NotImplementedError()

View File

@ -6,8 +6,9 @@ from domain.world import World
class VacuumMoveCommand(Command): class VacuumMoveCommand(Command):
def __init__(
def __init__(self, world: World, vacuum: Vacuum, move_vector: Tuple[int, int]) -> None: self, world: World, vacuum: Vacuum, move_vector: Tuple[int, int]
) -> None:
super().__init__() super().__init__()
self.world = world self.world = world
self.vacuum = vacuum self.vacuum = vacuum
@ -18,7 +19,12 @@ class VacuumMoveCommand(Command):
end_x = self.vacuum.x + self.dx end_x = self.vacuum.x + self.dx
end_y = self.vacuum.y + self.dy end_y = self.vacuum.y + self.dy
if end_x > self.world.width - 1 or end_y > self.world.height - 1 or end_x < 0 or end_y < 0: if (
end_x > self.world.width - 1
or end_y > self.world.height - 1
or end_x < 0
or end_y < 0
):
return return
if self.world.is_obstacle_at(end_x, end_y): if self.world.is_obstacle_at(end_x, end_y):

View File

@ -4,6 +4,6 @@ from domain.world import World
class Vacuum(Entity): class Vacuum(Entity):
def __init__(self, x: int, y: int): def __init__(self, x: int, y: int):
super().__init__(x, y, 'VACUUM') super().__init__(x, y, "VACUUM")
self.battery = 100 self.battery = 100
# TODO add more properties # TODO add more properties

View File

@ -5,12 +5,8 @@ class World:
def __init__(self, width: int, height: int): def __init__(self, width: int, height: int):
self.width = width self.width = width
self.height = height self.height = height
self.dust = [ self.dust = [[[] for j in range(height)] for i in range(width)]
[[] for j in range(height)] for i in range(width) self.obstacles = [[[] for j in range(height)] for i in range(width)]
]
self.obstacles = [
[[] for j in range(height)] for i in range(width)
]
self.vacuum = None self.vacuum = None
self.cat = None self.cat = None