Fixed typo in enum name. Unexplored edge listing/saving should work now.

This commit is contained in:
d3rped 2018-03-26 17:38:41 +02:00
parent 58553e38d0
commit fc3a9465cc
3 changed files with 12 additions and 10 deletions

View file

@ -121,12 +121,12 @@ class Communication:
if(edges == [] and self._status is Mode.EXPLORE):
if(self.planet.unexedge == []):
self.encode_message(Command.COMPLETE, None)
self._status = Mode.Complete
self._status = Mode.COMPLETE
self.process_messages()
else:
self.navto = next(filter(lambda x: x is not None, map(lambda edge: self.planet.shortest_path(self.planet.getcurnode(), edge), self.planet.unexedge)))
self._status = Mode.GOTOSTATION
else:
elif(edges != []):
self.navto = [(self.planet.getcurnode(), edges[0])]
def getdir(self):

View file

@ -110,7 +110,10 @@ class Move:
def getstats(self):
stats = list(self._odometry.coordinates_get())
stats.append(self._sensor.bumperwaspressed)
if(self._sensor.bumperwaspressed)
stats.append(-1)
else:
stats.append(1)
return stats
def turnto(self, direction):

View file

@ -82,18 +82,17 @@ class Planet:
return self._curdir
def checkedges(self, testnode):
validedges = []
if(self._curnode not in self._planetmap):
self._planetmap[self._curnode] = {}
for edges in testnode:
if(edges in self._planetmap[self._curnode]):
testnode.remove(edges)
if(testnode != [] and self._curnode not in self.unexedge):
if(edges not in self._planetmap[self._curnode]):
validedges.append(edges)
if(validedges != [] and self._curnode not in self.unexedge):
self.unexedge.append(self._curnode)
if(len(testnode) <= 1 and self._curnode in self.unexedge):
if(len(validedges) <= 1 and self._curnode in self.unexedge):
self.unexedge.remove(self._curnode)
print("MAP:", self._planetmap[self._curnode])
print("NODES:", testnode)
return testnode
return validedges
'''
Returns a shortest path between two nodes.