diff options
-rw-r--r-- | bin/ai/library/queue/binary_heap/library.nut | 6 | ||||
-rw-r--r-- | bin/ai/library/queue/binary_heap/main.nut | 14 | ||||
-rw-r--r-- | bin/ai/library/queue/fibonacci_heap/library.nut | 6 | ||||
-rw-r--r-- | bin/ai/library/queue/fibonacci_heap/main.nut | 16 | ||||
-rw-r--r-- | bin/ai/library/queue/priority_queue/library.nut | 6 | ||||
-rw-r--r-- | bin/ai/library/queue/priority_queue/main.nut | 12 |
6 files changed, 30 insertions, 30 deletions
diff --git a/bin/ai/library/queue/binary_heap/library.nut b/bin/ai/library/queue/binary_heap/library.nut index b0caf7d09..5216fb588 100644 --- a/bin/ai/library/queue/binary_heap/library.nut +++ b/bin/ai/library/queue/binary_heap/library.nut @@ -1,14 +1,14 @@ /* $Id$ */ -class BinaryHeap extends AILibrary { +class Binary_Heap extends AILibrary { function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetName() { return "Binary Heap"; } function GetShortName() { return "QUBH"; } function GetDescription() { return "An implementation of a Binary Heap"; } function GetVersion() { return 1; } function GetDate() { return "2008-06-10"; } - function CreateInstance() { return "BinaryHeap"; } + function CreateInstance() { return "Binary_Heap"; } function GetCategory() { return "Queue"; } } -RegisterLibrary(BinaryHeap()); +RegisterLibrary(Binary_Heap()); diff --git a/bin/ai/library/queue/binary_heap/main.nut b/bin/ai/library/queue/binary_heap/main.nut index 1bbb3914f..05fd452f3 100644 --- a/bin/ai/library/queue/binary_heap/main.nut +++ b/bin/ai/library/queue/binary_heap/main.nut @@ -5,7 +5,7 @@ * Peek and Pop always return the current lowest value in the list. * Sort is done on insertion and on deletion. */ -class BinaryHeap +class Binary_Heap { _queue = null; _count = 0; @@ -55,7 +55,7 @@ class BinaryHeap function Exists(item); }; -function BinaryHeap::Insert(item, priority) +function Binary_Heap::Insert(item, priority) { /* Append dummy entry */ _queue.append(0); @@ -71,7 +71,7 @@ function BinaryHeap::Insert(item, priority) return true; } -function BinaryHeap::Pop() +function Binary_Heap::Pop() { if (_count == 0) return null; @@ -86,19 +86,19 @@ function BinaryHeap::Pop() return node[0]; } -function BinaryHeap::Peek() +function Binary_Heap::Peek() { if (_count == 0) return null; return _queue[0][0]; } -function BinaryHeap::Count() +function Binary_Heap::Count() { return _count; } -function BinaryHeap::Exists(item) +function Binary_Heap::Exists(item) { /* Brute-force find the item (there is no faster way, as we don't have the priority number) */ foreach (node in _queue) { @@ -110,7 +110,7 @@ function BinaryHeap::Exists(item) -function BinaryHeap::_BubbleDown() +function Binary_Heap::_BubbleDown() { if (_count == 0) return; diff --git a/bin/ai/library/queue/fibonacci_heap/library.nut b/bin/ai/library/queue/fibonacci_heap/library.nut index 727a2477d..6cbd614da 100644 --- a/bin/ai/library/queue/fibonacci_heap/library.nut +++ b/bin/ai/library/queue/fibonacci_heap/library.nut @@ -1,14 +1,14 @@ /* $Id$ */ -class FibonacciHeap extends AILibrary { +class Fibonacci_Heap extends AILibrary { function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetName() { return "Fibonacci Heap"; } function GetShortName() { return "QUFH"; } function GetDescription() { return "An implementation of a Fibonacci Heap"; } function GetVersion() { return 1; } function GetDate() { return "2008-08-22"; } - function CreateInstance() { return "FibonacciHeap"; } + function CreateInstance() { return "Fibonacci_Heap"; } function GetCategory() { return "Queue"; } } -RegisterLibrary(FibonacciHeap()); +RegisterLibrary(Fibonacci_Heap()); diff --git a/bin/ai/library/queue/fibonacci_heap/main.nut b/bin/ai/library/queue/fibonacci_heap/main.nut index 7c6b3ece2..6be8bdd49 100644 --- a/bin/ai/library/queue/fibonacci_heap/main.nut +++ b/bin/ai/library/queue/fibonacci_heap/main.nut @@ -7,7 +7,7 @@ * Insert is implemented as a lazy insert, as it will simply add the new * node to the root list. Sort is done on every Pop operation. */ -class FibonacciHeap { +class Fibonacci_Heap { _min = null; _min_index = 0; _min_priority = 0; @@ -67,7 +67,7 @@ class FibonacciHeap { function Exists(item); }; -function FibonacciHeap::Insert(item, priority) { +function Fibonacci_Heap::Insert(item, priority) { /* Create a new node instance to add to the heap. */ local node = Node(); /* Changing params is faster than using constructor values */ @@ -86,7 +86,7 @@ function FibonacciHeap::Insert(item, priority) { _count++; } -function FibonacciHeap::Pop() { +function Fibonacci_Heap::Pop() { if (_count == 0) return null; @@ -150,16 +150,16 @@ function FibonacciHeap::Pop() { return z.item; } -function FibonacciHeap::Peek() { +function Fibonacci_Heap::Peek() { if (_count == 0) return null; return _min.item; } -function FibonacciHeap::Count() { +function Fibonacci_Heap::Count() { return _count; } -function FibonacciHeap::Exists(item) { +function Fibonacci_Heap::Exists(item) { return ExistsIn(_root_list, item); } @@ -169,7 +169,7 @@ function FibonacciHeap::Exists(item) { * @param item The item to search for. * @return True if the item is found, false otherwise. */ -function FibonacciHeap::ExistsIn(list, item) { +function Fibonacci_Heap::ExistsIn(list, item) { foreach (val in list) { if (val.item == item) { @@ -190,7 +190,7 @@ function FibonacciHeap::ExistsIn(list, item) { /** * Basic class the fibonacci heap is composed of. */ -class FibonacciHeap.Node { +class Fibonacci_Heap.Node { degree = null; child = null; diff --git a/bin/ai/library/queue/priority_queue/library.nut b/bin/ai/library/queue/priority_queue/library.nut index 22e97e4e9..1559393ee 100644 --- a/bin/ai/library/queue/priority_queue/library.nut +++ b/bin/ai/library/queue/priority_queue/library.nut @@ -1,14 +1,14 @@ /* $Id$ */ -class PriorityQueue extends AILibrary { +class Priority_Queue extends AILibrary { function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetName() { return "Priority Queue"; } function GetShortName() { return "QUPQ"; } function GetDescription() { return "An implementation of a Priority Queue"; } function GetVersion() { return 2; } function GetDate() { return "2008-06-10"; } - function CreateInstance() { return "PriorityQueue"; } + function CreateInstance() { return "Priority_Queue"; } function GetCategory() { return "Queue"; } } -RegisterLibrary(PriorityQueue()); +RegisterLibrary(Priority_Queue()); diff --git a/bin/ai/library/queue/priority_queue/main.nut b/bin/ai/library/queue/priority_queue/main.nut index bafc93ac5..feda89559 100644 --- a/bin/ai/library/queue/priority_queue/main.nut +++ b/bin/ai/library/queue/priority_queue/main.nut @@ -5,7 +5,7 @@ * Peek and Pop always return the current lowest value in the list. * Sort is done on insertion only. */ -class PriorityQueue +class Priority_Queue { _queue = null; _count = 0; @@ -56,7 +56,7 @@ class PriorityQueue function Exists(item); }; -function PriorityQueue::Insert(item, priority) +function Priority_Queue::Insert(item, priority) { /* Append dummy entry */ _queue.append(0); @@ -82,7 +82,7 @@ function PriorityQueue::Insert(item, priority) return true; } -function PriorityQueue::Pop() +function Priority_Queue::Pop() { if (_count == 0) return null; @@ -92,19 +92,19 @@ function PriorityQueue::Pop() return node[0]; } -function PriorityQueue::Peek() +function Priority_Queue::Peek() { if (_count == 0) return null; return _queue[_count - 1][0]; } -function PriorityQueue::Count() +function Priority_Queue::Count() { return _count; } -function PriorityQueue::Exists(item) +function Priority_Queue::Exists(item) { /* Brute-force find the item (there is no faster way, as we don't have the priority number) */ foreach (node in _queue) { |