mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* [javascript-astar] Fix typo in Heuristic types * [javascript-astar] Add @lazerwalker to header
38 lines
944 B
TypeScript
38 lines
944 B
TypeScript
// Type definitions for javascript-astar
|
|
// Project: https://github.com/bgrins/javascript-astar
|
|
// Definitions by: brian ridley <https://github.com/ptlis>, Mike Lazer-Walker <https://github.com/lazerwalker>
|
|
// 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 {
|
|
manhattan: 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;
|
|
}
|
|
|