diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2023-04-13 20:08:01 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2023-04-13 20:08:01 +0200 |
| commit | 5be1835344f37535559382acc953ec5901db0f48 (patch) | |
| tree | 4e4129e978464e964cde8c8f3a1c39ea27732c83 /src/pathfinder/Graph.ts | |
| parent | ca7f97e765024b3ba279f2c4485e28add7b7e1a7 (diff) | |
| download | boules-5be1835344f37535559382acc953ec5901db0f48.tar.gz boules-5be1835344f37535559382acc953ec5901db0f48.tar.zst boules-5be1835344f37535559382acc953ec5901db0f48.zip | |
Add pathfinder files
Change start to be simpler
Diffstat (limited to 'src/pathfinder/Graph.ts')
| -rw-r--r-- | src/pathfinder/Graph.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pathfinder/Graph.ts b/src/pathfinder/Graph.ts new file mode 100644 index 0000000..2a62f9a --- /dev/null +++ b/src/pathfinder/Graph.ts @@ -0,0 +1,25 @@ +/** + @module Graph +*/ +/** Types for directed graph */ +/** Shortuct */ +export type Graph = Array<Vertex>; + +/** Type for vertex of graph */ +export interface Vertex { + edges: Array<Edge>; // Graph is directed so all edges will have from set to `this` + start: boolean; + goal: boolean; + walkable: boolean; + uuid: string; + graph: Graph; + x?: number; + y?: number; +} +/** Type for edge of graph */ +export interface Edge { + from: Vertex; + to: Vertex; + weight: number; +} + |
