Finished the parsing of node stuff. Starting the DRDViz thing.

This commit is contained in:
Charles Descamps 2025-02-15 01:52:36 -07:00
parent 87a385d98c
commit 7ce4c6c5ae
2 changed files with 12 additions and 4 deletions

View file

@ -1,4 +1,6 @@
# Define Searcher, hSLD, SearchNode. # Define Searcher, hSLD, SearchNode.
import DRDViz
class SearchNode: class SearchNode:
def __init__(self, label, value): def __init__(self, label, value):
self.label = label self.label = label
@ -53,12 +55,18 @@ class Searcher:
nodePaths[mapContents[nodeIter][1]][mapContents[nodeIter][0]] = mapContents[nodeIter][2] nodePaths[mapContents[nodeIter][1]][mapContents[nodeIter][0]] = mapContents[nodeIter][2]
else: else:
nodePaths[mapContents[nodeIter][1]][mapContents[nodeIter][0]] = mapContents[nodeIter][2] nodePaths[mapContents[nodeIter][1]][mapContents[nodeIter][0]] = mapContents[nodeIter][2]
self.nodePaths = nodePaths
# print(nodeLoc) self.nodeLocs = nodeLoc
print(nodePaths) # need to get the myViz attribute by importing the DRDViz stuff.
self.myViz = DRDViz.DRDViz()
# now, start using the myViz thingy to 'display' a map.
def setStartGoal(self, startNode, endNode):
self.startNode = startNode
self.endNode = endNode
# (b) Show your program loading in the 30-node sample file. # (b) Show your program loading in the 30-node sample file.
s=Searcher("30node.txt") # s=Searcher("30node.txt")
s=Searcher("samplemap-1.txt")
# (c) Show you program setting start node=U and end node=T. # (c) Show you program setting start node=U and end node=T.
s.setStartGoal('U','T') s.setStartGoal('U','T')
# myViz should be a DRDViz instance -> save map to file on disk. # myViz should be a DRDViz instance -> save map to file on disk.

BIN
RouteFinding/30node.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB