be. dauntless. Astar. BinaryHeap

Summary
Constructor; makes a new heap array
Adds a tile to the binary heap
This method returns the lowest F from the heap.
This method returns the length of the heap
This method returns the position of the given ID in the heap
This method changes the given tile’s f in the heap and resorts it.

Variables

heap

private var heap: Array

Functions

BinaryHeap

public function BinaryHeap()

Constructor; makes a new heap array

Parameters

None

Returns

Nothing

addToHeap

public function addToHeap(newTile: Tile):Void

Adds a tile to the binary heap

Parameters

TileThe tile to be added

Returns

Nothing

getLowest

public function getLowest():Tile

This method returns the lowest F from the heap.  That F is deleted from the heap

Parameters

None

Returns

TileTile with the lowest F

getLength

public function getLength():Number

This method returns the length of the heap

Parameters

None

Returns

Nothing

getPosition

public function getPosition(id):Number

This method returns the position of the given ID in the heap

Parameters

idid of the node’s position to find

Returns

Numberposition of id in heap

updateList

public function updateList(cp_):Void

This method changes the given tile’s f in the heap and resorts it.

Parameters

Tilethe tile to be changed

Returns

Nothing

private var heap: Array
public function BinaryHeap()
Constructor; makes a new heap array
public function addToHeap(newTile: Tile):Void
Adds a tile to the binary heap
public function getLowest():Tile
This method returns the lowest F from the heap.
public function getLength():Number
This method returns the length of the heap
public function getPosition(id):Number
This method returns the position of the given ID in the heap
public function updateList(cp_):Void
This method changes the given tile’s f in the heap and resorts it.