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.
import DRDViz
class SearchNode:
def __init__(self, label, value):
self.label = label
@ -53,12 +55,18 @@ class Searcher:
nodePaths[mapContents[nodeIter][1]][mapContents[nodeIter][0]] = mapContents[nodeIter][2]
else:
nodePaths[mapContents[nodeIter][1]][mapContents[nodeIter][0]] = mapContents[nodeIter][2]
# print(nodeLoc)
print(nodePaths)
self.nodePaths = nodePaths
self.nodeLocs = nodeLoc
# 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.
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.
s.setStartGoal('U','T')
# 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