diff --git a/main.py b/main.py index b1386ab..4a3ae59 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,6 @@ # libraries +import ctypes + import pygame import time from pyglet.gl import * # for blocky textures @@ -63,7 +65,7 @@ def main(): pygame.display.update() # make the next move from sequence of actions - if len(action_sequence): + if any(action_sequence): action = action_sequence.pop(0) if action == const.Action.ROTATE_LEFT: minefield.agent.rotate_left() diff --git a/searching_algorithms/bfs.py b/searching_algorithms/bfs.py index a41b258..612c5d6 100644 --- a/searching_algorithms/bfs.py +++ b/searching_algorithms/bfs.py @@ -1,11 +1,12 @@ from __future__ import annotations from typing import List +import ctypes from project_constants import Direction, Action from minefield import Minefield # temporary goal for testing -GOAL = (9, 9) +GOAL = (1, 1) class State: @@ -62,8 +63,9 @@ def graphsearch(initial_state: State, minefield: Minefield, fringe: List[Node] = while True: # fringe empty -> solution not found - if not len(fringe): - return False + if not any(fringe): + ctypes.windll.user32.MessageBoxW(0, "Znowu się nie udało", "GAME OVER", 1) + return [] # get first element from fringe element = fringe.pop(0)