def __init__(self): self.gps = apiPoster() self.adjList = self.gps.getadjList() self.graph = Graph() for i in range(0,22500): self.graph.addedges(i,self.adjList[i])
def __init__(self): self.gps = apiPoster() self.adjList = self.gps.getadjList() self.graph = Graph() for i in range(0, 22500): self.graph.add_vertex(i) for i in range(0, 22500): toList = self.adjList[i] for vertex in toList: self.graph.add_edge(i, vertex, 1)
from GraphLoader import GraphLoader from apiPoster import apiPoster G = GraphLoader() poster = apiPoster() print(G) x, y = poster.getposition() currpos = int(150 * y + x) successvalue = 2 #iniitalize no flaws '''recursive dijkstra and poster''' def solvehackgps(currpos): optimalpath = G.getDijkstra(currpos, 22499) print('Dijkstra solved') dirlist = [] for i in range(1, len(optimalpath)): diff = optimalpath[i] - optimalpath[i - 1] if diff == 1: direct = 'right' elif diff == 150: direct = 'down' elif diff == -1: direct = 'left' else: direct = 'up' dirlist.append(direct) for i in range(0, len(dirlist)): if dirlist[i] == 'right':