fixed mine in GOAL bug
This commit is contained in:
parent
28cb1c1343
commit
b9bda6f883
4
main.py
4
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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user