USE AUTOFORMATTING

This commit is contained in:
Mateusz Dokowicz 2023-05-25 16:26:13 +02:00
parent 991dd93650
commit cbaaed7820

17
main.py
View File

@ -13,6 +13,7 @@ from domain.entities.earring import Earring
from domain.entities.docking_station import Doc_Station from domain.entities.docking_station import Doc_Station
from domain.world import World from domain.world import World
from view.renderer import Renderer from view.renderer import Renderer
# from AI_brain.movement import GoAnyDirectionBFS, State # from AI_brain.movement import GoAnyDirectionBFS, State
# from AI_brain.rotate_and_go_bfs import RotateAndGoBFS, State # from AI_brain.rotate_and_go_bfs import RotateAndGoBFS, State
from AI_brain.rotate_and_go_astar import RotateAndGoAStar, State from AI_brain.rotate_and_go_astar import RotateAndGoAStar, State
@ -97,12 +98,20 @@ class Main:
def handle_action2(self, action): def handle_action2(self, action):
if action == "GO": if action == "GO":
self.commands.append( self.commands.append(
VacuumMoveCommand(self.world, self.world.vacuum, self.world.vacuum.direction) VacuumMoveCommand(
self.world, self.world.vacuum, self.world.vacuum.direction
)
) )
elif action == "RR": elif action == "RR":
self.world.vacuum.direction = (-self.world.vacuum.direction[1], self.world.vacuum.direction[0]) self.world.vacuum.direction = (
-self.world.vacuum.direction[1],
self.world.vacuum.direction[0],
)
elif action == "RL": elif action == "RL":
self.world.vacuum.direction = (self.world.vacuum.direction[1], -self.world.vacuum.direction[0]) self.world.vacuum.direction = (
self.world.vacuum.direction[1],
-self.world.vacuum.direction[0],
)
def process_input(self): def process_input(self):
for event in pygame.event.get(): for event in pygame.event.get():
@ -153,7 +162,6 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
world.add_entity(Earring(9, 7)) world.add_entity(Earring(9, 7))
world.add_entity(Earring(5, 5)) world.add_entity(Earring(5, 5))
world.add_entity(Earring(4, 6)) world.add_entity(Earring(4, 6))
for x in range(world.width): for x in range(world.width):
for y in range(world.height): for y in range(world.height):
@ -163,6 +171,7 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
world.costs[x][y] = 10 world.costs[x][y] = 10
return world return world
if __name__ == "__main__": if __name__ == "__main__":
app = Main() app = Main()
if config["APP"]["movement"] == "human": if config["APP"]["movement"] == "human":