Cgraph - michael-lemberger/Pacman-Gps-Game GitHub Wiki

Crates a New ArrayList of GIS.Nodes Every Node is a vertex. Algorithm Calculates the neighbors of every vertex, considering the blocks(Uses line class,every line is an edge). At the end adds all the edges to graph.Graph.

Main Functions

private void buildNodes()

Adds all the block points and the player point to an ArrayList representing all the graph vertexes.

private void buildLines()

Adds all the walls to an ArrayList. Every wall is a Geom.Line object. We do this in order to check if two points edge goes inside the borders of a block.

public void IsConnected(Node vertex,ArrayList nodes)

Builds A line between two vertexes, than Iterates over the walls and check if the line is cutting one of the walls line equation. (x=a or y=b). If we find a vertex* that the line to him is not cutting any wall, we add to our node "vertex" neighbors list ,the node vertex*.

Neighbors explanation

⚠️ **GitHub.com Fallback** ⚠️