-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpath_finding.py
49 lines (43 loc) · 1.25 KB
/
path_finding.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pygame, sys
from mainMenu import mainMenu
from map import Map
from AStar import AStar, Node
from MinimalPath import minimalPath
from view import View, eventValues
import os
pygame.init()
icon = pygame.image.load('./images/icon.png')
pygame.display.set_icon(icon)
pygame.display.set_caption('Path Finder')
screenSize = (500,500)
screen = pygame.display.set_mode(screenSize)
timer_event = pygame.USEREVENT + 1
pygame.time.set_timer(timer_event, 50)
Algorithms = ["A*", "MinimalCost"]
menu = None
view = None
menuEnd = True
algorithmEnd = True
running = True
while running:
pygame.event.pump()
event = pygame.event.wait()
if event.type == pygame.QUIT:
running = False
elif event.type == timer_event:
pass
if not menuEnd:
menuEnd = menu.DrawMainMenu(event)
if menuEnd:
algorithmEnd=False
map = Map((30,30))
view = View(screen,map,Algorithms[menu.algorithmSelected])
elif not algorithmEnd:
view.viewWork(event)
algorithmEnd = view.reestart()
else:
menuEnd = False
algorithmEnd = True
menu = mainMenu(screen, Algorithms)
menu.MainMenuConfiguration()
pygame.display.update()