Skip to content

Commit 933023f

Browse files
committed
Working A* - press 'R' to test ;)
1 parent ef3d994 commit 933023f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Blobtory/Scripts/planet_former/AStar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def GetDist(pFrom: Tuple[float, float, float, float],
1414

1515
def ReconstructPath(cameFrom: Dict[NodeRef, NodeKey], current: NodeKey):
1616
totalPath: List[Tuple[float, float, float, float]] = [current.point]
17-
for key in cameFrom.keys():
18-
current = cameFrom[key]
17+
while current in cameFrom.keys():
18+
current = cameFrom[current]
1919
totalPath.insert(0, current.point)
2020

2121
return totalPath
@@ -43,7 +43,6 @@ def GetPathFromTo(self,
4343
pTo: Tuple[float, float, float, float]
4444
) -> List[Tuple[float, float, float, float]]:
4545
startNode = self.GetKeyNodeFromPoint(pFrom)
46-
4746
openSet = PriorityQueue()
4847
openSet.put((0, startNode))
4948
cameFrom: Dict[NodeRef, NodeKey] = {}

Blobtory/Scripts/planet_former/PlanetGenerator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def __init__(self, winCreator: WindowCreator, gridSize: int, radius: float):
6363
self.winCreator.base.accept("r", self.NextPoint)
6464

6565
def NextPoint(self):
66+
for i in range(20): next(self.listOfItems)
6667
examplePointTo: NodeKey = next(self.listOfItems)
6768

6869
self.sphere3.setPos(examplePointTo[0], examplePointTo[1], examplePointTo[2])

0 commit comments

Comments
 (0)