forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
javascript-astar.d.ts
37 lines (31 loc) · 893 Bytes
/
javascript-astar.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Type definitions for javascript-astar
// Project: https://github.com/bgrins/javascript-astar
// Definitions by: brian ridley <https://github.com/ptlis/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Graph {
grid: Array<Array<GridNode>>;
constructor(grid: Array<Array<number>>, options?: {diagonal?: boolean});
}
declare class GridNode {
x: number;
y: number;
}
interface Heuristic {
(pos0: {x: number, y: number}, pos1: {x: number, y: number}): number;
}
interface Heuristics {
manhatten: Heuristic;
diagonal: Heuristic;
}
declare namespace astar {
function search(
graph: Graph,
start: {x: number, y: number},
end: {x: number, y: number},
options?: {
closest?: boolean,
heuristic?: Heuristic
}
): Array<GridNode>;
var heuristics: Heuristics;
}