Fix some returns and other problems.

This commit is contained in:
Charles Descamps 2025-02-16 00:16:10 -07:00
parent 45f4f3b707
commit 29c46717d9
2 changed files with 1 additions and 5 deletions

View file

@ -114,14 +114,12 @@ class Searcher:
for item in nodeList: for item in nodeList:
if item not in self.open: if item not in self.open:
self.open.insert(0, item) self.open.insert(0, item)
return None
def insert_end(self, nodeList): def insert_end(self, nodeList):
# forwards "sort" # forwards "sort"
# loop through each element, and apply it to the end of the open list. # loop through each element, and apply it to the end of the open list.
for item in nodeList: for item in nodeList:
if item not in self.open: if item not in self.open:
self.open.append(item) self.open.append(item)
return None
def insert_ordered(self, nodeList): def insert_ordered(self, nodeList):
# sort by the lowest cost after adding all the elements to the open list. # sort by the lowest cost after adding all the elements to the open list.
# add the nodes to the list # add the nodes to the list
@ -132,11 +130,9 @@ class Searcher:
self.open.clear() self.open.clear()
# replace it with the sorted list by extending the blank list. # replace it with the sorted list by extending the blank list.
self.open.extend(sortedList) self.open.extend(sortedList)
return None
# (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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Before After
Before After