FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-pathfinding/pathfinding/finder/breadth_first.py at python2 · brean/python-pathfinding · GitHub
brean
/
python-pathfinding
Public
Notifications
You must be signed in to change notification settings
Fork
73
Star
383
Code
Issues
24
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-pathfinding
/
pathfinding
/
finder
/
breadth_first.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (29 loc) · 1.13 KB
Breadcrumbs
python-pathfinding
/
pathfinding
/
finder
/
breadth_first.py
Copy path
File metadata and controls
35 lines (29 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
from
.
finder
import
Finder
,
MAX_RUNS
,
TIME_LIMIT
from
..
core
.
diagonal_movement
import
DiagonalMovement
from
..
core
.
util
import
backtrace
class
BreadthFirstFinder
(
Finder
):
def
__init__
(
self
,
heuristic
=
None
,
weight
=
1
,
diagonal_movement
=
DiagonalMovement
.
never
,
time_limit
=
TIME_LIMIT
,
max_runs
=
MAX_RUNS
):
super
(
BreadthFirstFinder
,
self
).
__init__
(
heuristic
=
heuristic
,
weight
=
weight
,
weighted
=
False
,
diagonal_movement
=
diagonal_movement
,
time_limit
=
time_limit
,
max_runs
=
max_runs
)
if
not
diagonal_movement
:
self
.
diagonalMovement
=
DiagonalMovement
.
never
def
check_neighbors
(
self
,
start
,
end
,
grid
,
open_list
):
node
=
open_list
.
pop
(
0
)
node
.
closed
=
True
if
node
==
end
:
return
backtrace
(
end
)
neighbors
=
self
.
find_neighbors
(
grid
,
node
)
for
neighbor
in
neighbors
:
if
neighbor
.
closed
or
neighbor
.
opened
:
continue
open_list
.
append
(
neighbor
)
neighbor
.
opened
=
True
neighbor
.
parent
=
node
Back
|
FazBrowse Home
|
New Git URL