Valuator libraries.
More...
Public Member Functions |
constructor | List (list=null) |
| List constructor.
|
function | DoValuate (valuator,...) |
| Valuator function for functions that change the game state and as such are nore allowed as function for AIAbstarctList::Valuate.
|
function | SetValueAsItem () |
| Set the value of all items to the item.
|
function | ItemsToArray () |
| Get all of items as an array.
|
function | ValuesToArray () |
| Get all of values as an array.
|
function | AddItems (an_array) |
| Add items of AIList from array All the new items are added with value 0.
|
function | toarray () |
| Get all of data as an array with [item, value]-pairs.
|
function | AddFromArray (an_array) |
| Add all [item, value]-pairs from a given array to this list.
|
function | SortItemAscending () |
| Sort by item, ascending.
|
function | SortItemDescending () |
| Sort by item, descending.
|
function | SortValueAscending () |
| Sort by value, ascending.
|
function | SortValueDescending () |
| Sort by value, descending.
|
function | AddTile (tile) |
| Add a tile to the to-be-evaluated tiles.
|
function | RemoveTile (tile) |
| Remove a tile to the to-be-evaluated tiles.
|
function | AddRectangle (tile_from, tile_to) |
| Adds the rectangle between t1 and t2 to the list.
|
function | RemoveRectangle (tile_from, tile_to) |
| Remove the rectangle between t1 and t2 from the list.
|
function | Peek () |
| Get the topmost item from the list.
|
function | Pop () |
| Remove the topmost item from the list and return it.
|
function | Push (idx) |
| Add an item to the list.
|
function | CountIfRemoveBetweenValue (start, end) |
| Pre-count items left if Removes all items with a value above start and below end.
|
function | CountIfRemoveAboveValue (val) |
| Pre-count items left if Removes all items with a higher value than 'val'.
|
function | CountIfRemoveBelowValue (val) |
| Pre-count items left if Removes all items with a lower value than 'val'.
|
function | CountIfRemoveValue (val) |
| Pre-count items left if Remove all items with this value.
|
function | CountIfKeepValue (val) |
| Pre-count items left if Keep all items with this value.
|
function | CountIfRemoveTop (n) |
| Pre-count items left if Remove n items from top.
|
function | CountIfRemoveBottom (n) |
| Pre-count items left if Remove n items from bottom.
|
Public Attributes |
| _lib_class = "AILib.Common" |
Detailed Description
Constructor & Destructor Documentation
constructor List::List |
( |
list |
= null | ) |
|
|
inline |
List constructor.
- Parameters
-
list | optional AIList to copy |
Member Function Documentation
function List::AddFromArray |
( |
an_array |
| ) |
|
Add all [item, value]-pairs from a given array to this list.
- Parameters
-
function List::AddRectangle |
( |
tile_from |
, |
|
|
tile_to |
|
|
) |
| |
Adds the rectangle between t1 and t2 to the list.
- Parameters
-
tile_from | One corner of the tiles to add. |
tile_to | The other corner of the tiles to add. |
- Precondition
- AIMap::IsValidTile(tile_from).
-
AIMap::IsValidTile(tile_to).
function List::AddTile |
( |
tile |
| ) |
|
Add a tile to the to-be-evaluated tiles.
- Parameters
-
- Precondition
- AIMap::IsValidTile(tile).
function List::CountIfKeepValue |
( |
val |
| ) |
|
Pre-count items left if Keep all items with this value.
- Parameters
-
- Returns
- count of left item.
function List::CountIfRemoveAboveValue |
( |
val |
| ) |
|
Pre-count items left if Removes all items with a higher value than 'val'.
- Parameters
-
val | the value above which all items are removed. |
- Returns
- count of left item.
function List::CountIfRemoveBelowValue |
( |
val |
| ) |
|
Pre-count items left if Removes all items with a lower value than 'val'.
- Parameters
-
val | the value below which all items are removed. |
- Returns
- count of left item.
function List::CountIfRemoveBetweenValue |
( |
start |
, |
|
|
end |
|
|
) |
| |
Pre-count items left if Removes all items with a value above start and below end.
- Parameters
-
start | the lower bound of the to be removed values (exclusive). |
end | the upper bound of the to be removed valuens (exclusive). |
- Returns
- count of left item.
function List::CountIfRemoveBottom |
( |
n |
| ) |
|
Pre-count items left if Remove n items from bottom.
- Parameters
-
n | the number of item to remove from bottom. |
- Returns
- count of left item.
function List::CountIfRemoveTop |
( |
n |
| ) |
|
Pre-count items left if Remove n items from top.
- Parameters
-
n | the number of item to remove from top. |
- Returns
- count of left item.
function List::CountIfRemoveValue |
( |
val |
| ) |
|
Pre-count items left if Remove all items with this value.
- Parameters
-
- Returns
- count of left item.
function List::DoValuate |
( |
valuator |
, |
|
|
|
... |
|
) |
| |
Valuator function for functions that change the game state and as such are nore allowed as function for AIAbstarctList::Valuate.
- Parameters
-
valuator | Function to be used as valuator |
... | Additional argument to be passed to the valuator |
function List::ItemsToArray |
( |
| ) |
|
Get all of items as an array.
- Returns
- An array with all items in it.
Get the topmost item from the list.
- Precondition
- !IsEmpty()
- Returns
- the topmost item of the list
Remove the topmost item from the list and return it.
- Precondition
- !IsEmpty()
- Returns
- the topmost item of the list
function List::RemoveRectangle |
( |
tile_from |
, |
|
|
tile_to |
|
|
) |
| |
Remove the rectangle between t1 and t2 from the list.
- Parameters
-
t1 | One corner of the tiles to remove. |
t2 | The other corner of the tiles to remove. |
function List::RemoveTile |
( |
tile |
| ) |
|
Remove a tile to the to-be-evaluated tiles.
- Parameters
-
- Precondition
- AIMap::IsValidTile(tile).
function List::toarray |
( |
| ) |
|
Get all of data as an array with [item, value]-pairs.
- Returns
- An array with all data.
function List::ValuesToArray |
( |
| ) |
|
Get all of values as an array.
- Returns
- An array with all values in it.
The documentation for this class was generated from the following file: