USE AUTOFORMATTING
This commit is contained in:
parent
991dd93650
commit
cbaaed7820
17
main.py
17
main.py
@ -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():
|
||||||
@ -154,7 +163,6 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
|
|||||||
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):
|
||||||
if world.is_garbage_at(x, y):
|
if world.is_garbage_at(x, y):
|
||||||
@ -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":
|
||||||
|
Loading…
Reference in New Issue
Block a user