@Override public EdgeIteratorState getEdgeProps(int edgeId, int adjNode) { if (lg.isShortcut(edgeId)) throw new IllegalStateException( "Do not fetch shortcuts from BaseGraph use the LevelGraph instead"); return lg.getEdgeProps(edgeId, adjNode); }
int[] avoidWalls(int[] directions) { Node current = level.getNodeAt(pacX, pacY); Node toGoToNode = level.getNodeAt(pacX + directions[0], pacY + directions[1]); ArrayList<Edge> neighbourEdges = current.getEdges(); for (int i = 0; i < neighbourEdges.size(); i++) if (neighbourEdges.get(i).start == current && neighbourEdges.get(i).end == toGoToNode) return directions; System.out.println("collision detected"); System.out.println(directions[0] + " " + directions[1]); int randomDirection = (int) Math.signum(r.nextFloat() - .5); System.out.println(randomDirection); return new int[] {directions[1] * randomDirection, directions[0] * randomDirection}; }
@Override public EdgeExplorer createEdgeExplorer(final EdgeFilter filter) { if (filter == EdgeFilter.ALL_EDGES) return createEdgeExplorer(); return lg.createEdgeExplorer( new EdgeFilter() { @Override public boolean accept(EdgeIteratorState edgeIterState) { if (((EdgeSkipIterator) edgeIterState).isShortcut()) return false; return filter.accept(edgeIterState); } }); }
public void eatPill(int x, int y) { level.eatPill(x, y); }
int[] runTowardsPillsCloserThan(int searchDepth) { Node current = level.getNodeAt(pacX, pacY); return nextPillBFS(current); }
@Override public AllEdgesIterator getAllEdges() { final AllEdgesSkipIterator tmpIter = lg.getAllEdges(); return new AllEdgesIterator() { @Override public int getCount() { return tmpIter.getCount(); } @Override public boolean next() { while (tmpIter.next()) { if (!tmpIter.isShortcut()) { return true; } } return false; } @Override public int getEdge() { return tmpIter.getEdge(); } @Override public int getBaseNode() { return tmpIter.getBaseNode(); } @Override public int getAdjNode() { return tmpIter.getAdjNode(); } @Override public PointList fetchWayGeometry(int type) { return tmpIter.fetchWayGeometry(type); } @Override public EdgeIteratorState setWayGeometry(PointList list) { return tmpIter.setWayGeometry(list); } @Override public double getDistance() { return tmpIter.getDistance(); } @Override public EdgeIteratorState setDistance(double dist) { return tmpIter.setDistance(dist); } @Override public long getFlags() { return tmpIter.getFlags(); } @Override public EdgeIteratorState setFlags(long flags) { return tmpIter.setFlags(flags); } @Override public String getName() { return tmpIter.getName(); } @Override public EdgeIteratorState setName(String name) { return tmpIter.setName(name); } @Override public boolean getBoolean(int key, boolean reverse, boolean _default) { return tmpIter.getBoolean(key, reverse, _default); } @Override public int getAdditionalField() { return tmpIter.getAdditionalField(); } @Override public EdgeIteratorState setAdditionalField(int value) { return tmpIter.setAdditionalField(value); } @Override public EdgeIteratorState copyPropertiesTo(EdgeIteratorState edge) { return tmpIter.copyPropertiesTo(edge); } @Override public EdgeIteratorState detach(boolean reverse) { return tmpIter.detach(reverse); } }; }
@Override public EdgeIteratorState edge(int a, int b, double distance, boolean bothDirections) { return lg.edge(a, b, distance, bothDirections); }
@Override public EdgeIteratorState edge(int a, int b) { return lg.edge(a, b); }
@Override public BBox getBounds() { return lg.getBounds(); }
@Override public NodeAccess getNodeAccess() { return lg.getNodeAccess(); }
@Override public int getNodes() { return lg.getNodes(); }
@Override public GraphExtension getExtension() { return lg.getExtension(); }
@Override public EdgeExplorer createEdgeExplorer() { return lg.createEdgeExplorer(NO_SHORTCUTS); }