So I am trying to use a set to keep track of tuples that contain a tuple and a list of tuples. Here is an example of what is in the set before the error:
((1, 16), [(1, 1), (1, 13), (1, 14), (1, 15), (1, 18), (2, 1), (2, 4), (2, 7), (2, 10), (2, 13), (2, 18), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 18)])
Here is the error I get:
Traceback (most recent call last):
File "src/graph.py", line 60, in <module>
end_node, A_expanded = A_search_multiple(maze,start,dot_locs)
File "/home/lstrait2/cs440/mp1/src/search_multiple.py", line 37, in A_search_multiple
if((loc,state) not in closed):
TypeError: unhashable type: 'list'
[lstrait2@linux-a2 mp1]$ gedit src/search_multiple.py
Is there anything I can do to make this work? Basically I am using the set to make sure no tuple of the form (location, list of locations) appears twice.
locandstate? Presumably one or both is alist, so should be converted totuplefirst.if (loc, tuple(state)) not in closed:(note the unnecessary parentheses have been removed).