From f7b97c5f74ab94a96a6abe7958fc0f9a8b9d1b82 Mon Sep 17 00:00:00 2001 From: Mateusz Dokowicz Date: Thu, 30 Mar 2023 18:27:51 +0200 Subject: [PATCH] auto formatting --- domain/commands/command.py | 1 - domain/commands/vacuum_move_command.py | 12 +++++++++--- domain/entities/vacuum.py | 2 +- domain/world.py | 8 ++------ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/domain/commands/command.py b/domain/commands/command.py index d90aed5..377a0f3 100644 --- a/domain/commands/command.py +++ b/domain/commands/command.py @@ -1,4 +1,3 @@ class Command: def run(self): raise NotImplementedError() - \ No newline at end of file diff --git a/domain/commands/vacuum_move_command.py b/domain/commands/vacuum_move_command.py index 9f1b558..b868e33 100644 --- a/domain/commands/vacuum_move_command.py +++ b/domain/commands/vacuum_move_command.py @@ -6,8 +6,9 @@ from domain.world import World class VacuumMoveCommand(Command): - - def __init__(self, world: World, vacuum: Vacuum, move_vector: Tuple[int, int]) -> None: + def __init__( + self, world: World, vacuum: Vacuum, move_vector: Tuple[int, int] + ) -> None: super().__init__() self.world = world self.vacuum = vacuum @@ -18,7 +19,12 @@ class VacuumMoveCommand(Command): end_x = self.vacuum.x + self.dx 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 if self.world.is_obstacle_at(end_x, end_y): diff --git a/domain/entities/vacuum.py b/domain/entities/vacuum.py index 3d05dfa..eaa14e5 100644 --- a/domain/entities/vacuum.py +++ b/domain/entities/vacuum.py @@ -4,6 +4,6 @@ from domain.world import World class Vacuum(Entity): def __init__(self, x: int, y: int): - super().__init__(x, y, 'VACUUM') + super().__init__(x, y, "VACUUM") self.battery = 100 # TODO add more properties diff --git a/domain/world.py b/domain/world.py index d760e2f..e6d10b5 100644 --- a/domain/world.py +++ b/domain/world.py @@ -5,12 +5,8 @@ class World: def __init__(self, width: int, height: int): self.width = width self.height = height - self.dust = [ - [[] for j in range(height)] for i in range(width) - ] - self.obstacles = [ - [[] for j in range(height)] for i in range(width) - ] + self.dust = [[[] 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.cat = None