bin/ai/regression/regression.nut
author truebrain
Tue, 24 Jun 2008 11:37:33 +0000
branchnoai
changeset 11063 bd71d932973e
parent 11058 3305a425f55b
child 11099 7683a97b89f9
permissions -rw-r--r--
(svn r13620) [NoAI] -Fix: foreach() on empty lists gave weird error (bug by Yexo)
10899
126faeece8b6 (svn r13450) [NoAI] -Change [API CHANGE]: renamed library category 'sets' to 'queue', as it represents more what the implementations do
truebrain
parents: 10896
diff changeset
     1
import("queue.priority_queue", "PQ", 2);
126faeece8b6 (svn r13450) [NoAI] -Change [API CHANGE]: renamed library category 'sets' to 'queue', as it represents more what the implementations do
truebrain
parents: 10896
diff changeset
     2
import("queue.binary_heap", "BH", 1);
11039
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
     3
import("graph.aystar", "AS", 4);
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
     4
import("pathfinder.road", "RPF", 3);
10889
ecb77cfc4a10 (svn r13440) [NoAI] -Add: introducing ai/library, a method to load libraries into your AI.
truebrain
parents: 10871
diff changeset
     5
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
     6
class Regression extends AIController {
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
     7
	function Start();
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
     8
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
     9
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    10
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    11
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    12
function Regression::TestInit()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    13
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    14
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    15
	print("--TestInit--");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    16
	print(" TickTest: " + this.GetTick());
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
    17
	this.Sleep(1);
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    18
	print(" TickTest: " + this.GetTick());
9749
ee414c031e73 (svn r12229) [NoAI] -Fix: AISetting()s functions can be static too
truebrain
parents: 9745
diff changeset
    19
	print(" SetCommandDelay: " + AISettings.SetCommandDelay(1));
10852
f02afc46afa8 (svn r13403) [NoAI] -Add: wrapper to read the game settings directly without *any* promises on the results being stable in the future when OpenTTD changes the semantics.
rubidium
parents: 10847
diff changeset
    20
	print(" IsValid(vehicle.plane_speed): " + AIGameSettings.IsValid("vehicle.plane_speed"));
f02afc46afa8 (svn r13403) [NoAI] -Add: wrapper to read the game settings directly without *any* promises on the results being stable in the future when OpenTTD changes the semantics.
rubidium
parents: 10847
diff changeset
    21
	print(" vehicle.plane_speed: " + AIGameSettings.GetValue("vehicle.plane_speed"));
10649
9034b80fdbdb (svn r13193) [NoAI] -Add: allow AIs to be packed in a .tar. one AI per tar, always in a subdir. It looks for main.nut in the first dir it finds in the archive
truebrain
parents: 10383
diff changeset
    22
	require("require.nut");
10938
df6235dd2b7a (svn r13492) [NoAI] -Add: added the 'standard' functions max() and min() in global scope
truebrain
parents: 10933
diff changeset
    23
	print(" min(6, 3): " + min(6, 3));
df6235dd2b7a (svn r13492) [NoAI] -Add: added the 'standard' functions max() and min() in global scope
truebrain
parents: 10933
diff changeset
    24
	print(" min(3, 6): " + min(3, 6));
df6235dd2b7a (svn r13492) [NoAI] -Add: added the 'standard' functions max() and min() in global scope
truebrain
parents: 10933
diff changeset
    25
	print(" max(6, 3): " + max(6, 3));
df6235dd2b7a (svn r13492) [NoAI] -Add: added the 'standard' functions max() and min() in global scope
truebrain
parents: 10933
diff changeset
    26
	print(" max(3, 6): " + max(3, 6));
11058
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    27
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    28
	print(" AIList Consistency Tests");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    29
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    30
	print(" Value Descending");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    31
	local list = AIList();
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    32
	list.AddItem( 5, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    33
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    34
	list.AddItem(15, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    35
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    36
	list.AddItem(25, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    37
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    38
	list.AddItem(35, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    39
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    40
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    41
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    42
		list.RemoveItem(i - 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    43
		list.RemoveItem(i - 5);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    44
		list.RemoveItem(i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    45
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    46
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    47
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    48
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    49
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    50
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    51
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    52
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    53
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    54
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    55
		list.SetValue(i, 2);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    56
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    57
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    58
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    59
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    60
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    61
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    62
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    63
	list = AIList();
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    64
	list.Sort(AIAbstractList.SORT_BY_VALUE, true);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    65
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    66
	print(" Value Ascending");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    67
	list.AddItem( 5, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    68
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    69
	list.AddItem(15, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    70
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    71
	list.AddItem(25, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    72
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    73
	list.AddItem(35, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    74
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    75
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    76
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    77
		list.RemoveItem(i + 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    78
		list.RemoveItem(i + 5);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    79
		list.RemoveItem(i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    80
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    81
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    82
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    83
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    84
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    85
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    86
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    87
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    88
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    89
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    90
		list.SetValue(i, 50);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    91
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    92
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    93
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    94
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    95
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    96
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    97
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    98
	list = AIList();
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
    99
	list.Sort(AIAbstractList.SORT_BY_ITEM, false);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   100
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   101
	print(" Item Descending");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   102
	list.AddItem( 5, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   103
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   104
	list.AddItem(15, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   105
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   106
	list.AddItem(25, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   107
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   108
	list.AddItem(35, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   109
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   110
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   111
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   112
		list.RemoveItem(i - 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   113
		list.RemoveItem(i - 5);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   114
		list.RemoveItem(i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   115
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   116
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   117
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   118
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   119
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   120
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   121
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   122
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   123
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   124
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   125
		list.SetValue(i, 2);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   126
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   127
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   128
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   129
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   130
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   131
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   132
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   133
	list = AIList();
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   134
	list.Sort(AIAbstractList.SORT_BY_ITEM, true);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   135
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   136
	print(" Item Ascending");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   137
	list.AddItem( 5, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   138
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   139
	list.AddItem(15, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   140
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   141
	list.AddItem(25, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   142
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   143
	list.AddItem(35, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   144
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   145
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   146
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   147
		list.RemoveItem(i + 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   148
		list.RemoveItem(i + 5);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   149
		list.RemoveItem(i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   150
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   151
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   152
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   153
	list.AddItem(10, 10);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   154
	list.AddItem(20, 20);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   155
	list.AddItem(30, 30);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   156
	list.AddItem(40, 40);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   157
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   158
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   159
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   160
		list.SetValue(i, 50);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   161
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   162
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   163
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   164
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   165
		print("   " + i);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   166
	}
11063
bd71d932973e (svn r13620) [NoAI] -Fix: foreach() on empty lists gave weird error (bug by Yexo)
truebrain
parents: 11058
diff changeset
   167
bd71d932973e (svn r13620) [NoAI] -Fix: foreach() on empty lists gave weird error (bug by Yexo)
truebrain
parents: 11058
diff changeset
   168
	list.Clear();
bd71d932973e (svn r13620) [NoAI] -Fix: foreach() on empty lists gave weird error (bug by Yexo)
truebrain
parents: 11058
diff changeset
   169
	foreach (idx, val in list) {
bd71d932973e (svn r13620) [NoAI] -Fix: foreach() on empty lists gave weird error (bug by Yexo)
truebrain
parents: 11058
diff changeset
   170
		print("   " + idx);
bd71d932973e (svn r13620) [NoAI] -Fix: foreach() on empty lists gave weird error (bug by Yexo)
truebrain
parents: 11058
diff changeset
   171
	}
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   172
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   173
9487
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   174
function Regression::Std()
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   175
{
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   176
	print("");
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   177
	print("--Std--");
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   178
	print(" abs(-21): " + abs(-21));
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   179
	print(" abs( 21): " + abs(21));
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   180
}
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
   181
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   182
function Regression::Base()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   183
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   184
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   185
	print("--AIBase--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   186
	print("  Rand():       " + AIBase.Rand());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   187
	print("  Rand():       " + AIBase.Rand());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   188
	print("  Rand():       " + AIBase.Rand());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   189
	print("  RandRange(0): " + AIBase.RandRange(0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   190
	print("  RandRange(0): " + AIBase.RandRange(0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   191
	print("  RandRange(0): " + AIBase.RandRange(0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   192
	print("  RandRange(1): " + AIBase.RandRange(1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   193
	print("  RandRange(1): " + AIBase.RandRange(1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   194
	print("  RandRange(1): " + AIBase.RandRange(1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   195
	print("  RandRange(2): " + AIBase.RandRange(2));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   196
	print("  RandRange(2): " + AIBase.RandRange(2));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   197
	print("  RandRange(2): " + AIBase.RandRange(2));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   198
	print("  RandRange(9): " + AIBase.RandRange(9));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   199
	print("  RandRange(9): " + AIBase.RandRange(9));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   200
	print("  RandRange(9): " + AIBase.RandRange(9));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   201
	print("  Chance(1, 2): " + AIBase.Chance(1, 2));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   202
	print("  Chance(1, 2): " + AIBase.Chance(1, 2));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   203
	print("  Chance(1, 2): " + AIBase.Chance(1, 2));
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   204
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   205
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   206
function Regression::Airport()
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   207
{
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   208
	print("");
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   209
	print("--AIAirport--");
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   210
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   211
	print("  IsHangarTile():       " + AIAirport.IsHangarTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   212
	print("  IsAirportTile():      " + AIAirport.IsAirportTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   213
	print("  GetHangarOfAirport(): " + AIAirport.GetHangarOfAirport(32116));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   214
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   215
	for (local i = -1; i < 10; i++) {
9773
d2c20cd38f18 (svn r12266) [NoAI] -Fix: [API CHANGE] minor typo in Ai*r*portAvailable (tnx yorick)
truebrain
parents: 9771
diff changeset
   216
		print("  AirportAvailable(" + i + "):         " + AIAirport.AirportAvailable(i));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   217
		print("  GetAirportWidth(" + i + "):          " + AIAirport.GetAirportWidth(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   218
		print("  GetAirportHeight(" + i + "):         " + AIAirport.GetAirportHeight(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   219
		print("  GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   220
	}
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   221
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   222
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   223
	print("  BuildAirport():       " + AIAirport.BuildAirport(32116, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   224
	print("  IsHangarTile():       " + AIAirport.IsHangarTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   225
	print("  IsAirportTile():      " + AIAirport.IsAirportTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   226
	print("  GetHangarOfAirport(): " + AIAirport.GetHangarOfAirport(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   227
	print("  IsHangarTile():       " + AIAirport.IsHangarTile(32119));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   228
	print("  IsAirportTile():      " + AIAirport.IsAirportTile(32119));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   229
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   230
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   231
	print("  RemoveAirport():      " + AIAirport.RemoveAirport(32118));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   232
	print("  IsHangarTile():       " + AIAirport.IsHangarTile(32119));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   233
	print("  IsAirportTile():      " + AIAirport.IsAirportTile(32119));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   234
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   235
	print("  BuildAirport():       " + AIAirport.BuildAirport(32116, 0));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   236
}
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   237
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   238
function Regression::Bridge()
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   239
{
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   240
	local j = 0;
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   241
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   242
	print("");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   243
	print("--Bridge--");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   244
	for (local i = -1; i < 14; i++) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   245
		if (AIBridge.IsValidBridge(i)) j++;
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   246
		print("  Bridge " + i);
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   247
		print("    IsValidBridge():    " + AIBridge.IsValidBridge(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   248
		print("    GetName():          " + AIBridge.GetName(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   249
		print("    GetMaxSpeed():      " + AIBridge.GetMaxSpeed(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   250
		print("    GetPrice():         " + AIBridge.GetPrice(i, 5));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   251
		print("    GetMaxLength():     " + AIBridge.GetMaxLength(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   252
		print("    GetMinLength():     " + AIBridge.GetMinLength(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   253
		print("    GetYearAvailable(): " + AIBridge.GetYearAvailable(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   254
	}
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   255
	print("  Valid Bridges:        " + j);
9793
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   256
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   257
	print("  IsBridgeTile():       " + AIBridge.IsBridgeTile(33160));
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   258
	print("  RemoveBridge():       " + AIBridge.RemoveBridge(33155));
9867
b7d9ffe24f81 (svn r12589) [NoAI] -Add: GetLastError support for AIBridge.
rubidium
parents: 9865
diff changeset
   259
	print("  GetLastErrorString(): " + AIError.GetLastErrorString());
10691
a60393d87c0b (svn r13235) [NoAI] -Change [API CHANGE]: AITunnel.GetOtherTunnelEnd() now returns INVALID_TILE if no other end is found
glx
parents: 10675
diff changeset
   260
	print("  GetOtherBridgeEnd():  " + AIBridge.GetOtherBridgeEnd(33160));
9793
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   261
	print("  BuildBridge():        " + AIBridge.BuildBridge(AIVehicle.VEHICLE_ROAD, 5, 33160, 33155));
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   262
	print("  IsBridgeTile():       " + AIBridge.IsBridgeTile(33160));
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   263
	print("  IsBridgeTile():       " + AIBridge.IsBridgeTile(33155));
10691
a60393d87c0b (svn r13235) [NoAI] -Change [API CHANGE]: AITunnel.GetOtherTunnelEnd() now returns INVALID_TILE if no other end is found
glx
parents: 10675
diff changeset
   264
	print("  GetOtherBridgeEnd():  " + AIBridge.GetOtherBridgeEnd(33160));
9867
b7d9ffe24f81 (svn r12589) [NoAI] -Add: GetLastError support for AIBridge.
rubidium
parents: 9865
diff changeset
   265
	print("  BuildBridge():        " + AIBridge.BuildBridge(AIVehicle.VEHICLE_ROAD, 5, 33160, 33155));
b7d9ffe24f81 (svn r12589) [NoAI] -Add: GetLastError support for AIBridge.
rubidium
parents: 9865
diff changeset
   266
	print("  GetLastErrorString(): " + AIError.GetLastErrorString());
9793
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   267
	print("  RemoveBridge():       " + AIBridge.RemoveBridge(33155));
c5fb53240401 (svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents: 9792
diff changeset
   268
	print("  IsBridgeTile():       " + AIBridge.IsBridgeTile(33160));
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   269
}
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   270
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   271
function Regression::BridgeList()
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   272
{
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   273
	local list = AIBridgeList();
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   274
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   275
	print("");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   276
	print("--BridgeList--");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   277
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   278
	list.Valuate(AIBridge.GetMaxSpeed);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   279
	print("  MaxSpeed ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   280
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   281
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   282
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   283
	list.Valuate(AIBridge.GetPrice, 5);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   284
	print("  Price ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   285
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   286
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   287
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   288
	list.Valuate(AIBridge.GetMaxLength);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   289
	print("  MaxLength ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   290
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   291
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   292
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   293
	list.Valuate(AIBridge.GetMinLength);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   294
	print("  MinLength ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   295
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   296
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   297
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   298
	list.Valuate(AIBridge.GetYearAvailable);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   299
	print("  YearAvailable ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   300
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   301
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   302
	}
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   303
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   304
	local list = AIBridgeList_Length(14);
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   305
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   306
	print("");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   307
	print("--BridgeList_Length--");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   308
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   309
	list.Valuate(AIBridge.GetMaxSpeed);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   310
	print("  MaxSpeed ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   311
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   312
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   313
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   314
	list.Valuate(AIBridge.GetPrice, 14);
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   315
	print("  Price ListDump:");
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   316
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   317
		print("    " + i + " => " + list.GetValue(i));
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   318
	}
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   319
}
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
   320
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   321
function Regression::Cargo()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   322
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   323
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   324
	print("--AICargo--");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   325
	for (local i = -1; i < 15; i++) {
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   326
		print("  Cargo " + i);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   327
		print("    IsValidCargo():          " + AICargo.IsValidCargo(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   328
		print("    GetCargoLabel():         '" + AICargo.GetCargoLabel(i)+ "'");
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   329
		print("    IsFreight():             " + AICargo.IsFreight(i));
10675
b16fdb811ebb (svn r13219) [NoAI] -Add: added AICargo.HasCargoClass(), which allows you to find, say, passenger-based cargo (tnx kuifware for the pointer!)
truebrain
parents: 10668
diff changeset
   330
		print("    HasCargoClass():         " + AICargo.HasCargoClass(i, AICargo.CC_PASSENGERS));
10831
f7e17819358b (svn r13382) [NoAI] -Add: added AICargo::GetTownEffect()
truebrain
parents: 10776
diff changeset
   331
		print("    GetTownEffect():         " + AICargo.GetTownEffect(i));
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   332
		print("    GetCargoIncome(0, 0):    " + AICargo.GetCargoIncome(i, 0, 0));
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   333
		print("    GetCargoIncome(10, 10):  " + AICargo.GetCargoIncome(i, 10, 10));
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   334
		print("    GetCargoIncome(100, 10): " + AICargo.GetCargoIncome(i, 100, 10));
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   335
		print("    GetCargoIncome(10, 100): " + AICargo.GetCargoIncome(i, 10, 100));
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   336
	}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   337
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   338
9785
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   339
function Regression::CargoList()
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   340
{
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   341
	local list = AICargoList();
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   342
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   343
	print("");
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   344
	print("--CargoList--");
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   345
	print("  Count():            " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   346
	list.Valuate(AICargo.IsFreight);
9788
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   347
	print("  IsFreight ListDump:");
9785
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   348
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
9788
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   349
		print("    " + i + " => " + list.GetValue(i));
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   350
	}
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   351
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   352
	list.Valuate(AICargo.GetCargoIncome, 100, 100);
9788
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   353
	print("  CargoIncomes(100, 100) ListDump:");
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   354
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e9dbd4ec1784 (svn r12284) [NoAI] -Add: added AICargoList_v(IsFreight|CargoIncomes) (Morloth)
truebrain
parents: 9785
diff changeset
   355
		print("    " + i + " => " + list.GetValue(i));
9785
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   356
	}
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   357
}
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
   358
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   359
function Regression::Company()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   360
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   361
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   362
	print("--Company--");
9558
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   363
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   364
	/* Test AIXXXMode() in scopes */
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   365
	{
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   366
		local test = AITestMode();
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   367
		print("  SetCompanyName():     " + AICompany.SetCompanyName("Regression"));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   368
		print("  SetCompanyName():     " + AICompany.SetCompanyName("Regression"));
9558
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   369
		{
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   370
			local exec = AIExecMode();
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   371
			print("  SetCompanyName():     " + AICompany.SetCompanyName("Regression"));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   372
			print("  SetCompanyName():     " + AICompany.SetCompanyName("Regression"));
9865
f241472f09dc (svn r12555) [NoAI] -Add: support for GetLastError for AICompany.
rubidium
parents: 9844
diff changeset
   373
			print("  GetLastErrorString(): " + AIError.GetLastErrorString());
9558
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   374
		}
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   375
	}
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   376
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   377
	print("  GetCompanyName():            " + AICompany.GetCompanyName(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   378
	print("  GetPresidentName():          " + AICompany.GetPresidentName(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   379
	print("  SetPresidentName():          " + AICompany.SetPresidentName("Regression AI"));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   380
	print("  GetPresidentName():          " + AICompany.GetPresidentName(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   381
	print("  GetCompanyValue():           " + AICompany.GetCompanyValue(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   382
	print("  GetBankBalance():            " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   383
	print("  GetCompanyName():            " + AICompany.GetCompanyName(240));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   384
	print("  GetLoanAmount():             " + AICompany.GetLoanAmount());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   385
	print("  GetMaxLoanAmount():          " + AICompany.GetMaxLoanAmount());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   386
	print("  GetLoanInterval():           " + AICompany.GetLoanInterval());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   387
	print("  SetLoanAmount(1):            " + AICompany.SetLoanAmount(1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   388
	print("  SetLoanAmount(100):          " + AICompany.SetLoanAmount(100));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   389
	print("  SetLoanAmount(10000):        " + AICompany.SetLoanAmount(10000));
9865
f241472f09dc (svn r12555) [NoAI] -Add: support for GetLastError for AICompany.
rubidium
parents: 9844
diff changeset
   390
	print("  GetLastErrorString():        " + AIError.GetLastErrorString());
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   391
	print("  GetBankBalance():            " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   392
	print("  GetLoanAmount():             " + AICompany.GetLoanAmount());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   393
	print("  SetMinimumLoanAmount(31337): " + AICompany.SetMinimumLoanAmount(31337));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   394
	print("  GetBankBalance():            " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   395
	print("  GetLoanAmount():             " + AICompany.GetLoanAmount());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   396
	print("  SetLoanAmount(10000):        " + AICompany.SetLoanAmount(AICompany.GetMaxLoanAmount()));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   397
	print("  GetBankBalance():            " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   398
	print("  GetLoanAmount():             " + AICompany.GetLoanAmount());
9808
0b40f556e051 (svn r12318) [NoAI] -Add: added AICompany::(Build|Get)CompanyHQ (college of Morloth)
truebrain
parents: 9807
diff changeset
   399
	print("  GetCompanyHQ():              " + AICompany.GetCompanyHQ(AICompany.MY_COMPANY));
0b40f556e051 (svn r12318) [NoAI] -Add: added AICompany::(Build|Get)CompanyHQ (college of Morloth)
truebrain
parents: 9807
diff changeset
   400
	print("  BuildCompanyHQ():            " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(127, 129)));
0b40f556e051 (svn r12318) [NoAI] -Add: added AICompany::(Build|Get)CompanyHQ (college of Morloth)
truebrain
parents: 9807
diff changeset
   401
	print("  GetCompanyHQ():              " + AICompany.GetCompanyHQ(AICompany.MY_COMPANY));
0b40f556e051 (svn r12318) [NoAI] -Add: added AICompany::(Build|Get)CompanyHQ (college of Morloth)
truebrain
parents: 9807
diff changeset
   402
	print("  BuildCompanyHQ():            " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 129)));
0b40f556e051 (svn r12318) [NoAI] -Add: added AICompany::(Build|Get)CompanyHQ (college of Morloth)
truebrain
parents: 9807
diff changeset
   403
	print("  GetCompanyHQ():              " + AICompany.GetCompanyHQ(AICompany.MY_COMPANY));
9865
f241472f09dc (svn r12555) [NoAI] -Add: support for GetLastError for AICompany.
rubidium
parents: 9844
diff changeset
   404
	print("  BuildCompanyHQ():            " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 128)));
f241472f09dc (svn r12555) [NoAI] -Add: support for GetLastError for AICompany.
rubidium
parents: 9844
diff changeset
   405
	print("  GetLastErrorString():        " + AIError.GetLastErrorString());
10291
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   406
	print("  GetAutoRenewStatus();        " + AICompany.GetAutoRenewStatus(AICompany.MY_COMPANY));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   407
	print("  SetAutoRenewStatus(true);    " + AICompany.SetAutoRenewStatus(true));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   408
	print("  GetAutoRenewStatus();        " + AICompany.GetAutoRenewStatus(AICompany.MY_COMPANY));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   409
	print("  SetAutoRenewStatus(true);    " + AICompany.SetAutoRenewStatus(true));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   410
	print("  SetAutoRenewStatus(false);   " + AICompany.SetAutoRenewStatus(false));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   411
	print("  GetAutoRenewMonths();        " + AICompany.GetAutoRenewMonths(AICompany.MY_COMPANY));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   412
	print("  SetAutoRenewMonths(-12);     " + AICompany.SetAutoRenewMonths(-12));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   413
	print("  GetAutoRenewMonths();        " + AICompany.GetAutoRenewMonths(AICompany.MY_COMPANY));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   414
	print("  SetAutoRenewMonths(-12);     " + AICompany.SetAutoRenewMonths(-12));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   415
	print("  SetAutoRenewMonths(6);       " + AICompany.SetAutoRenewMonths(6));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   416
	print("  GetAutoRenewMoney();         " + AICompany.GetAutoRenewMoney(AICompany.MY_COMPANY));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   417
	print("  SetAutoRenewMoney(200000);   " + AICompany.SetAutoRenewMoney(200000));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   418
	print("  GetAutoRenewMoney();         " + AICompany.GetAutoRenewMoney(AICompany.MY_COMPANY));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   419
	print("  SetAutoRenewMoney(200000);   " + AICompany.SetAutoRenewMoney(200000));
11cb78922367 (svn r12823) [NoAI] -Add: added AICompany::(G|S)etAutoRenew(Status|Months|Money)
glx
parents: 10193
diff changeset
   420
	print("  SetAutoRenewMoney(100000);   " + AICompany.SetAutoRenewMoney(100000));
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   421
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   422
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   423
function Regression::Engine()
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   424
{
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   425
	local j = 0;
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   426
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   427
	print("");
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   428
	print("--Engine--");
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   429
	for (local i = -1; i < 257; i++) {
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   430
		if (AIEngine.IsValidEngine(i)) j++;
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   431
		print("  Engine " + i);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   432
		print("    IsValidEngine():    " + AIEngine.IsValidEngine(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   433
		print("    GetName():          " + AIEngine.GetName(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   434
		print("    GetCargoType():     " + AIEngine.GetCargoType(i));
9809
9b21c21052fa (svn r12325) [NoAI] -Add: added AIEngine:CanRefitCargo()
truebrain
parents: 9808
diff changeset
   435
		print("    CanRefitCargo():    " + AIEngine.CanRefitCargo(i, 1));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   436
		print("    GetCapacity():      " + AIEngine.GetCapacity(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   437
		print("    GetReliability():   " + AIEngine.GetReliability(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   438
		print("    GetMaxSpeed():      " + AIEngine.GetMaxSpeed(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   439
		print("    GetPrice():         " + AIEngine.GetPrice(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   440
		print("    GetMaxAge():        " + AIEngine.GetMaxAge(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   441
		print("    GetRunningCost():   " + AIEngine.GetRunningCost(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   442
		print("    GetVehicleType():   " + AIEngine.GetVehicleType(i));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   443
		print("    GetRoadType():      " + AIEngine.GetRoadType(i));
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   444
	}
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   445
	print("  Valid Engines:        " + j);
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   446
}
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
   447
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   448
function Regression::EngineList()
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   449
{
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   450
	local list = AIEngineList(AIVehicle.VEHICLE_ROAD);
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   451
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   452
	print("");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   453
	print("--EngineList--");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   454
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   455
	list.Valuate(AIEngine.GetCargoType);
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   456
	print("  CargoType ListDump:");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   457
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   458
		print("    " + i + " => " + list.GetValue(i));
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   459
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   460
	list.Valuate(AIEngine.GetCapacity);
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   461
	print("  Capacity ListDump:");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   462
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   463
		print("    " + i + " => " + list.GetValue(i));
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   464
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   465
	list.Valuate(AIEngine.GetReliability);
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   466
	print("  Reliability ListDump:");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   467
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   468
		print("    " + i + " => " + list.GetValue(i));
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   469
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   470
	list.Valuate(AIEngine.GetMaxSpeed);
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   471
	print("  MaxSpeed ListDump:");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   472
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   473
		print("    " + i + " => " + list.GetValue(i));
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   474
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   475
	list.Valuate(AIEngine.GetPrice);
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   476
	print("  Price ListDump:");
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   477
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   478
		print("    " + i + " => " + list.GetValue(i));
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   479
	}
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   480
}
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
   481
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   482
function Regression::Event()
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   483
{
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   484
	print("");
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   485
	print("--Event--");
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   486
	AIEventController.Test();
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   487
	local e = AIEventController.GetNextEvent();
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   488
	print("  GetNextEvent:      " + (e == null ? "null" : "instance"));
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   489
	print("    GetEventType:    " + e.GetEventType());
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   490
	local c = AIEventTest.Convert(e);
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   491
	print("    Convert:         " + (c == null ? "null" : "instance"));
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   492
	print("      GetTest:       " + c.GetTest());
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   493
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   494
	print("  DisableEvent(1):   done");
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   495
	AIEventController.DisableEvent(1);
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   496
	AIEventController.Test();
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   497
	e = AIEventController.GetNextEvent();
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   498
	print("  GetNextEvent:      " + (e == null ? "null" : "instance"));
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   499
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   500
	print("  EnableEvent(1):    done");
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   501
	AIEventController.EnableEvent(1);
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   502
	AIEventController.Test();
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   503
	e = AIEventController.GetNextEvent();
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   504
	print("  GetNextEvent:      " + (e == null ? "null" : "instance"));
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   505
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   506
	{
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   507
		print("  DisableAllEvents():done");
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   508
		AIEventController.DisableAllEvents();
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   509
		AIEventController.Test();
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   510
		e = AIEventController.GetNextEvent();
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   511
		print("  GetNextEvent:      " + (e == null ? "null" : "instance"));
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   512
	}
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   513
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   514
	print("  EnableEvent(1):    done");
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   515
	AIEventController.EnableEvent(1);
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   516
	AIEventController.Test();
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   517
	e = AIEventController.GetNextEvent();
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   518
	print("  GetNextEvent:      " + (e == null ? "null" : "instance"));
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   519
	e = AIEventController.GetNextEvent();
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
   520
	print("  GetNextEvent:      " + (e == null ? "null" : "instance"));
9823
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
   521
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
   522
	AIEventController.EnableAllEvents();
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   523
}
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
   524
11039
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   525
function cost_callback(old_path, new_tile, new_direction, self) { if (old_path == null) return 0; return old_path.GetCost() + 1; }
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   526
function estimate_callback(tile, direction, goals, self) { return goals[0] - tile; }
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   527
function neighbours_callback(path, cur_tile, self) { return [[cur_tile + 1, 1]]; }
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   528
function check_direction_callback(tile, existing_direction, new_direction, self) { return false; }
10910
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   529
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   530
function Regression::Graph()
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   531
{
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   532
	print("--AyStar--");
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   533
	print("  Fastest path:");
11039
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   534
	local as = AS(cost_callback, estimate_callback, neighbours_callback, check_direction_callback);
10912
48d072a192b5 (svn r13463) [NoAI] -Change [Library CHANGE]: AyStar is now more object oriented, and you can indicate the amount of iterations FindPath should do in one go (tnx to Yexo and TrueBrain)
truebrain
parents: 10910
diff changeset
   535
48d072a192b5 (svn r13463) [NoAI] -Change [Library CHANGE]: AyStar is now more object oriented, and you can indicate the amount of iterations FindPath should do in one go (tnx to Yexo and TrueBrain)
truebrain
parents: 10910
diff changeset
   536
	local path = false;
11039
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   537
	as.InitializePath([[1, 1]], [10]);
10912
48d072a192b5 (svn r13463) [NoAI] -Change [Library CHANGE]: AyStar is now more object oriented, and you can indicate the amount of iterations FindPath should do in one go (tnx to Yexo and TrueBrain)
truebrain
parents: 10910
diff changeset
   538
	while (path == false) path = as.FindPath(5);
48d072a192b5 (svn r13463) [NoAI] -Change [Library CHANGE]: AyStar is now more object oriented, and you can indicate the amount of iterations FindPath should do in one go (tnx to Yexo and TrueBrain)
truebrain
parents: 10910
diff changeset
   539
10910
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   540
	while (path != null) {
11039
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   541
		print("    Tile " + path.GetTile());
10910
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   542
		path = path.GetParent();
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   543
	}
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   544
}
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
   545
11057
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   546
function Regression::Group()
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   547
{
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   548
	print ("");
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   549
	print("--Group--");
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   550
	print("  SetAutoReplace():         " + AIGroup.SetAutoReplace(AIGroup.ALL_GROUP, 116, 117));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   551
	print("  GetEngineReplacement():   " + AIGroup.GetEngineReplacement(AIGroup.ALL_GROUP, 116));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   552
	print("  GetNumEngines():          " + AIGroup.GetNumEngines(AIGroup.ALL_GROUP, 116));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   553
	print("  AIRoad.BuildRoadDepot():  " + AIRoad.BuildRoadDepot(10000, 10001));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   554
	local vehicle = AIVehicle.BuildVehicle(10000, 116);
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   555
	print("  AIVehicle.BuildVehicle(): " + vehicle);
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   556
	print("  GetNumEngines():          " + AIGroup.GetNumEngines(AIGroup.ALL_GROUP, 116));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   557
	local group = AIGroup.CreateGroup(AIVehicle.VEHICLE_ROAD);
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   558
	print("  CreateGroup():            " + group);
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   559
	print("  MoveVehicle():            " + AIGroup.MoveVehicle(group, vehicle));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   560
	print("  GetNumEngines():          " + AIGroup.GetNumEngines(group, 116));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   561
	print("  GetNumEngines():          " + AIGroup.GetNumEngines(AIGroup.ALL_GROUP, 116));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   562
	print("  GetNumEngines():          " + AIGroup.GetNumEngines(AIGroup.DEFAULT_GROUP, 116));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   563
	print("  GetName():                " + AIGroup.GetName(0));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   564
	print("  GetName():                " + AIGroup.GetName(1));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   565
	print("  AIVehicle.SellVehicle():  " + AIVehicle.SellVehicle(vehicle));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   566
	print("  AITile.DemolishTile():    " + AITile.DemolishTile(10000));
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   567
}
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
   568
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   569
function Regression::Industry()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   570
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   571
	local j = 0;
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   572
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   573
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   574
	print("--Industry--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   575
	print("  GetMaxIndustryID():  " + AIIndustry.GetMaxIndustryID());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   576
	print("  GetIndustryCount():  " + AIIndustry.GetIndustryCount());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   577
	for (local i = -1; i < AIIndustry.GetMaxIndustryID() + 1; i++) {
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   578
		if (AIIndustry.IsValidIndustry(i)) j++;
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   579
		print("  Industry " + i);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   580
		print("    IsValidIndustry(): " + AIIndustry.IsValidIndustry(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   581
		print("    GetName():         " + AIIndustry.GetName(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   582
		print("    GetLocation():     " + AIIndustry.GetLocation(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   583
		print("    GetProduction():   " + AIIndustry.GetProduction(i, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   584
		print("    IsCargoAccepted(): " + AIIndustry.IsCargoAccepted(i, 1));
9810
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   585
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   586
		local cargo_list = AICargoList();
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   587
		for (local j = cargo_list.Begin(); cargo_list.HasNext(); j = cargo_list.Next()) {
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   588
			if (AIIndustry.GetProduction(i, j) > 0) {
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   589
				print("	   GetLastMonthProduction(): " + AIIndustry.GetLastMonthProduction(i, j));
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   590
				print("	   GetLastMonthTransported(): " + AIIndustry.GetLastMonthTransported(i, j));
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   591
			}
a84fc1be9e3b (svn r12327) [NoAI] -Add: GetLastMonth(Production|Transported) (Morloth)
truebrain
parents: 9809
diff changeset
   592
		}
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   593
	}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   594
	print("  Valid Industries:    " + j);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   595
	print("  GetIndustryCount():  " + AIIndustry.GetIndustryCount());
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   596
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   597
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   598
function Regression::IndustryList()
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   599
{
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   600
	local list = AIIndustryList();
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   601
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   602
	print("");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   603
	print("--IndustryList--");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   604
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   605
	list.Valuate(AIIndustry.GetLocation);
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   606
	print("  Location ListDump:");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   607
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   608
		print("    " + i + " => " + list.GetValue(i));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   609
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   610
	list.Valuate(AIIndustry.GetDistanceManhattanToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   611
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   612
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   613
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   614
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   615
	list.Valuate(AIIndustry.GetDistanceSquareToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   616
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   617
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   618
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   619
	}
10383
bda80b3e9c25 (svn r12925) [NoAI] -Add: added AIIndustry::GetAmountOfStationsAround() (Yexo)
truebrain
parents: 10381
diff changeset
   620
	list.Valuate(AIIndustry.GetAmountOfStationsAround);
bda80b3e9c25 (svn r12925) [NoAI] -Add: added AIIndustry::GetAmountOfStationsAround() (Yexo)
truebrain
parents: 10381
diff changeset
   621
	print("  GetAmountOfStationsAround(30000) ListDump:");
bda80b3e9c25 (svn r12925) [NoAI] -Add: added AIIndustry::GetAmountOfStationsAround() (Yexo)
truebrain
parents: 10381
diff changeset
   622
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bda80b3e9c25 (svn r12925) [NoAI] -Add: added AIIndustry::GetAmountOfStationsAround() (Yexo)
truebrain
parents: 10381
diff changeset
   623
		print("    " + i + " => " + list.GetValue(i));
bda80b3e9c25 (svn r12925) [NoAI] -Add: added AIIndustry::GetAmountOfStationsAround() (Yexo)
truebrain
parents: 10381
diff changeset
   624
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   625
	list.Valuate(AIIndustry.IsCargoAccepted, 1);
9710
ba44f8c1fd52 (svn r11294) [NoAI] -Add: added AIIndustry::IsCargoAccepted + Valuator (on request by Kilinich)
truelight
parents: 9709
diff changeset
   626
	print("  CargoAccepted(1) ListDump:");
ba44f8c1fd52 (svn r11294) [NoAI] -Add: added AIIndustry::IsCargoAccepted + Valuator (on request by Kilinich)
truelight
parents: 9709
diff changeset
   627
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
ba44f8c1fd52 (svn r11294) [NoAI] -Add: added AIIndustry::IsCargoAccepted + Valuator (on request by Kilinich)
truelight
parents: 9709
diff changeset
   628
		print("    " + i + " => " + list.GetValue(i));
ba44f8c1fd52 (svn r11294) [NoAI] -Add: added AIIndustry::IsCargoAccepted + Valuator (on request by Kilinich)
truelight
parents: 9709
diff changeset
   629
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   630
	list.Valuate(AIIndustry.GetProduction, 1);
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   631
	list.KeepAboveValue(50);
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   632
	print("  KeepAboveValue(50): done");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   633
	print("  Count():             " + list.Count());
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   634
	print("  Production ListDump:");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   635
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   636
		print("    " + i + " => " + list.GetValue(i));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   637
	}
9776
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   638
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   639
	list = AIIndustryList_CargoAccepting(1);
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   640
	print("--IndustryList_CargoAccepting--");
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   641
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   642
	list.Valuate(AIIndustry.GetLocation);
9776
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   643
	print("  Location ListDump:");
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   644
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   645
		print("    " + i + " => " + list.GetValue(i));
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   646
	}
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   647
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   648
	list = AIIndustryList_CargoProducing(1);
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   649
	print("--IndustryList_CargoProducing--");
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   650
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   651
	list.Valuate(AIIndustry.GetLocation);
9776
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   652
	print("  Location ListDump:");
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   653
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   654
		print("    " + i + " => " + list.GetValue(i));
ee9923d46fba (svn r12270) [NoAI] -Add: added AIIndustryList_CargoAccepting and AIIndustryList_CargoProducing, which gives you Industry Lists with from where to where you can move cargo
truebrain
parents: 9773
diff changeset
   655
	}
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   656
}
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   657
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   658
function CustomValuator(list_id)
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   659
{
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   660
	return list_id * 4343;
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   661
}
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   662
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   663
function Regression::List()
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   664
{
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   665
	local list = AIList();
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   666
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   667
	print("");
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   668
	print("--List--");
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   669
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   670
	print("  IsEmpty():     " + list.IsEmpty());
9664
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   671
	list.AddItem(1, 1);
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   672
	list.AddItem(2, 2);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   673
	for (local i = 1000; i < 1100; i++) {
9664
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   674
		list.AddItem(i, i);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   675
	}
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   676
	list.RemoveItem(1050);
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   677
	list.RemoveItem(1150);
9664
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   678
	list.ChangeItem(1051, 12);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   679
	print("  Count():       " + list.Count());
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   680
	print("  HasItem(1050): " + list.HasItem(1050));
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   681
	print("  HasItem(1051): " + list.HasItem(1051));
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   682
	print("  IsEmpty():     " + list.IsEmpty());
9665
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   683
	list.Sort(AIAbstractList.SORT_BY_ITEM, true);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   684
	print("  List Dump:");
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   685
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   686
		print("    " + i + " => " + list.GetValue(i));
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   687
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   688
	list.Valuate(CustomValuator);
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   689
	print("  Custom ListDump:");
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   690
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   691
		print("    " + i + " => " + list.GetValue(i));
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   692
	}
10957
7a140b4cd91d (svn r13511) [NoAI] -Fix: add a reference to objects given in Valuate(), so they remain valid during their usage. This allows nameless functions (lambda functions) in Valuate() on long lists.
truebrain
parents: 10952
diff changeset
   693
	list.Valuate(function (a) { return a * 42; });
7a140b4cd91d (svn r13511) [NoAI] -Fix: add a reference to objects given in Valuate(), so they remain valid during their usage. This allows nameless functions (lambda functions) in Valuate() on long lists.
truebrain
parents: 10952
diff changeset
   694
	print("  Custom ListDump:");
7a140b4cd91d (svn r13511) [NoAI] -Fix: add a reference to objects given in Valuate(), so they remain valid during their usage. This allows nameless functions (lambda functions) in Valuate() on long lists.
truebrain
parents: 10952
diff changeset
   695
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
7a140b4cd91d (svn r13511) [NoAI] -Fix: add a reference to objects given in Valuate(), so they remain valid during their usage. This allows nameless functions (lambda functions) in Valuate() on long lists.
truebrain
parents: 10952
diff changeset
   696
		print("    " + i + " => " + list.GetValue(i));
7a140b4cd91d (svn r13511) [NoAI] -Fix: add a reference to objects given in Valuate(), so they remain valid during their usage. This allows nameless functions (lambda functions) in Valuate() on long lists.
truebrain
parents: 10952
diff changeset
   697
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   698
	list.Valuate(AIBase.RandItem);
9660
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   699
	print("  Randomize ListDump:");
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   700
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   701
		print("    " + i + " => " + list.GetValue(i));
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   702
	}
9665
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   703
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   704
	list.KeepTop(10);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   705
	print("  KeepTop(10):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   706
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   707
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   708
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   709
	list.KeepBottom(8);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   710
	print("  KeepBottom(8):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   711
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   712
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   713
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   714
	list.RemoveBottom(2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   715
	print("  RemoveBottom(2):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   716
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   717
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   718
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   719
	list.RemoveTop(2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   720
	print("  RemoveTop(2):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   721
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   722
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   723
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   724
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   725
	local list2 = AIList();
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   726
	list2.AddItem(1003, 0);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   727
	list2.AddItem(1004, 0);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   728
	list.RemoveList(list2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   729
	print("  RemoveList({1003, 1004}):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   730
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   731
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   732
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   733
	list2.AddItem(1005, 0);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   734
	list.KeepList(list2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   735
	print("  KeepList({1003, 1004, 1005}):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   736
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   737
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   738
	}
9796
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   739
	list2.Clear();
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   740
	for (local i = 4000; i < 4003; i++) {
11058
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   741
		list2.AddItem(i, i * 2);
9796
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   742
	}
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   743
	list2.AddItem(1005, 1005);
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   744
	list.AddList(list2);
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   745
	print("  AddList({1005, 4000, 4001, 4002}):");
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   746
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   747
		print("    " + i + " => " + list.GetValue(i));
83d54622190c (svn r12300) [NoAI] -Add: added AIAbstractList.AddList() (on request by Progman)
truebrain
parents: 9794
diff changeset
   748
	}
11058
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   749
	list[4000] = 50;
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   750
	list[4006] = 12;
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   751
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   752
	print("  foreach():");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   753
	foreach (idx, val in list) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   754
		print("    " + idx + " => " + val);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   755
	}
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   756
	print("  []:");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   757
	print("    4000 => " + list[4000]);
9665
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   758
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   759
	list.Clear();
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   760
	print("  IsEmpty():     " + list.IsEmpty());
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   761
}
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   762
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   763
function Regression::Map()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   764
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   765
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   766
	print("--Map--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   767
	print("  GetMapSize():     " + AIMap.GetMapSize());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   768
	print("  GetMapSizeX():    " + AIMap.GetMapSizeX());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   769
	print("  GetMapSizeY():    " + AIMap.GetMapSizeY());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   770
	print("  GetTileX(123):    " + AIMap.GetTileX(123));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   771
	print("  GetTileY(123):    " + AIMap.GetTileY(123));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   772
	print("  GetTileIndex():   " + AIMap.GetTileIndex(123, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   773
	print("  GetTileIndex():   " + AIMap.GetTileIndex(0, 123));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   774
	print("  GetTileIndex():   " + AIMap.GetTileIndex(0, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   775
	print("  GetTileIndex():   " + AIMap.GetTileIndex(-1, -1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   776
	print("  GetTileIndex():   " + AIMap.GetTileIndex(10000, 10000));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   777
	print("  IsValidTile(123): " + AIMap.IsValidTile(123));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   778
	print("  GetTileX(124):    " + AIMap.GetTileX(124));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   779
	print("  GetTileY(124):    " + AIMap.GetTileY(124));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   780
	print("  IsValidTile(124): " + AIMap.IsValidTile(124));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   781
	print("  IsValidTile(0):   " + AIMap.IsValidTile(0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   782
	print("  IsValidTile(-1):  " + AIMap.IsValidTile(-1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   783
	print("  IsValidTile():    " + AIMap.IsValidTile(AIMap.GetMapSize()));
9801
03a3eebd7fb7 (svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents: 9796
diff changeset
   784
	print("  IsValidTile():    " + AIMap.IsValidTile(AIMap.GetMapSize() - AIMap.GetMapSizeX() - 2));
9834
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9831
diff changeset
   785
	print("  DemolishTile():   " + AITile.DemolishTile(19592));
9abe20fc83e5 (svn r12497) [NoAI] -Change [API CHANGE]: AIMap.DemolishTile -> AITile.DemolishTile (that makes much more sense, doesn't it? ;))
truebrain
parents: 9831
diff changeset
   786
	print("  DemolishTile():   " + AITile.DemolishTile(19335));
9492
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   787
	print("  Distance");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   788
	print("    DistanceManhattan(): " + AIMap.DistanceManhattan(1, 10000));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   789
	print("    DistanceMax():       " + AIMap.DistanceMax(1, 10000));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   790
	print("    DistanceSquare():    " + AIMap.DistanceSquare(1, 10000));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   791
	print("    DistanceFromEdge():  " + AIMap.DistanceFromEdge(10000));
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   792
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   793
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   794
function Regression::Marine()
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   795
{
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   796
	print("");
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   797
	print("--AIMarine--");
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   798
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   799
	print("  IsWaterDepotTile():   " + AIMarine.IsWaterDepotTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   800
	print("  IsDockTile():         " + AIMarine.IsDockTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   801
	print("  IsBuoyTile():         " + AIMarine.IsBuoyTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   802
	print("  IsLockTile():         " + AIMarine.IsLockTile(32116));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   803
	print("  IsCanalTile():        " + AIMarine.IsCanalTile(32116));
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   804
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   805
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   806
	print("  BuildWaterDepot():    " + AIMarine.BuildWaterDepot(28479, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   807
	print("  BuildDock():          " + AIMarine.BuildDock(29253));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   808
	print("  BuildBuoy():          " + AIMarine.BuildBuoy(28481));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   809
	print("  BuildLock():          " + AIMarine.BuildLock(28487));
10933
57aa2e01942c (svn r13486) [NoAI] -Add: function to determine what TransportTypes a tile holds.
rubidium
parents: 10931
diff changeset
   810
	print("  HasTransportType():   " + AITile.HasTransportType(32127, AITile.TRANSPORT_WATER));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   811
	print("  BuildCanal():         " + AIMarine.BuildCanal(32127));
10933
57aa2e01942c (svn r13486) [NoAI] -Add: function to determine what TransportTypes a tile holds.
rubidium
parents: 10931
diff changeset
   812
	print("  HasTransportType():   " + AITile.HasTransportType(32127, AITile.TRANSPORT_WATER));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   813
	print("  IsWaterDepotTile():   " + AIMarine.IsWaterDepotTile(28479));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   814
	print("  IsDockTile():         " + AIMarine.IsDockTile(29253));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   815
	print("  IsBuoyTile():         " + AIMarine.IsBuoyTile(28481));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   816
	print("  IsLockTile():         " + AIMarine.IsLockTile(28487));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   817
	print("  IsCanalTile():        " + AIMarine.IsCanalTile(32127));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   818
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   819
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   820
	print("  RemoveWaterDepot():   " + AIMarine.RemoveWaterDepot(28479));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   821
	print("  RemoveDock():         " + AIMarine.RemoveDock(29253));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   822
	print("  RemoveBuoy():         " + AIMarine.RemoveBuoy(28481));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   823
	print("  RemoveLock():         " + AIMarine.RemoveLock(28487));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   824
	print("  RemoveCanal():        " + AIMarine.RemoveCanal(32127));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   825
	print("  IsWaterDepotTile():   " + AIMarine.IsWaterDepotTile(28479));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   826
	print("  IsDockTile():         " + AIMarine.IsDockTile(29253));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   827
	print("  IsBuoyTile():         " + AIMarine.IsBuoyTile(28481));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   828
	print("  IsLockTile():         " + AIMarine.IsLockTile(28487));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   829
	print("  IsCanalTile():        " + AIMarine.IsCanalTile(32127));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   830
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   831
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   832
	print("  BuildWaterDepot():    " + AIMarine.BuildWaterDepot(28479, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   833
	print("  BuildDock():          " + AIMarine.BuildDock(29253));
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   834
}
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
   835
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   836
function Regression::Order()
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   837
{
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   838
	print("");
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   839
	print("--Order--");
10844
affb2821fb9f (svn r13395) [NoAI] -Fix [API CHANGE]: Rename AIOrder::GetNumberOfORders to AIOrder::GetOrderCount
truebrain
parents: 10831
diff changeset
   840
	print("  GetOrderCount():       " + AIOrder.GetOrderCount(11));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   841
	print("  GetOrderDestination(): " + AIOrder.GetOrderDestination(11, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   842
	print("  AreOrderFlagsValid():  " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   843
	print("  IsValidVehicleOrder(): " + AIOrder.IsValidVehicleOrder(11, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   844
	print("  GetOrderFlags():       " + AIOrder.GetOrderFlags(11, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   845
	print("  AppendOrder():         " + AIOrder.AppendOrder(11, 33416, AIOrder.AIOF_TRANSFER));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   846
	print("  InsertOrder():         " + AIOrder.InsertOrder(11, 0, 33416, AIOrder.AIOF_TRANSFER));
10844
affb2821fb9f (svn r13395) [NoAI] -Fix [API CHANGE]: Rename AIOrder::GetNumberOfORders to AIOrder::GetOrderCount
truebrain
parents: 10831
diff changeset
   847
	print("  GetOrderCount():       " + AIOrder.GetOrderCount(11));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   848
	print("  IsValidVehicleOrder(): " + AIOrder.IsValidVehicleOrder(11, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   849
	print("  RemoveOrder():         " + AIOrder.RemoveOrder(11, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   850
	print("  ChangeOrder():         " + AIOrder.ChangeOrder(11, 0, AIOrder.AIOF_FULL_LOAD));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   851
	print("  GetOrderDestination(): " + AIOrder.GetOrderDestination(11, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   852
	print("  CopyOrders():          " + AIOrder.CopyOrders(11, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   853
	print("  CopyOrders():          " + AIOrder.CopyOrders(12, 11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   854
	print("  ShareOrders():         " + AIOrder.ShareOrders(12, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   855
	print("  ShareOrders():         " + AIOrder.ShareOrders(12, 11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   856
	print("  UnshareOrders():       " + AIOrder.UnshareOrders(12));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   857
	print("  AppendOrder():         " + AIOrder.AppendOrder(11, 33421, AIOrder.AIOF_NONE));
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   858
9745
fb2454d70f37 (svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents: 9737
diff changeset
   859
	local list = AIStationList_Vehicle(11);
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   860
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   861
	print("");
9745
fb2454d70f37 (svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents: 9737
diff changeset
   862
	print("--StationList_Vehicle--");
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   863
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   864
	list.Valuate(AIStation.GetLocation);
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   865
	print("  Location ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   866
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   867
		print("    " + i + " => " + list.GetValue(i));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   868
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   869
	list.Valuate(AIStation.GetCargoWaiting, 0);
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   870
	print("  CargoWaiting(0) ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   871
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   872
		print("    " + i + " => " + list.GetValue(i));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   873
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   874
	list.Valuate(AIStation.GetCargoWaiting, 1);
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   875
	print("  CargoWaiting(1) ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   876
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   877
		print("    " + i + " => " + list.GetValue(i));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   878
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   879
	list.Valuate(AIStation.GetCargoRating, 1);
9648
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   880
	print("  CargoRating(1) ListDump:");
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   881
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   882
		print("    " + i + " => " + list.GetValue(i));
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   883
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   884
	list.Valuate(AIStation.GetDistanceManhattanToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   885
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   886
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   887
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   888
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   889
	list.Valuate(AIStation.GetDistanceSquareToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   890
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   891
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   892
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   893
	}
10361
4cdffd48480f (svn r12902) [NoAI] -Fix r12901 [API CHANGE]: renamed IsWithinTownRadius to IsWithinTownInfluence, as that reflects the meaning much better
truebrain
parents: 10360
diff changeset
   894
	list.Valuate(AIStation.IsWithinTownInfluence, 0);
4cdffd48480f (svn r12902) [NoAI] -Fix r12901 [API CHANGE]: renamed IsWithinTownRadius to IsWithinTownInfluence, as that reflects the meaning much better
truebrain
parents: 10360
diff changeset
   895
	print("  IsWithinTownInfluence(0) ListDump:");
10360
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
   896
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
   897
		print("    " + i + " => " + list.GetValue(i));
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
   898
	}
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   899
9745
fb2454d70f37 (svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents: 9737
diff changeset
   900
	list = AIVehicleList_Station(3);
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   901
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   902
	print("");
9745
fb2454d70f37 (svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents: 9737
diff changeset
   903
	print("--VehicleList_Station--");
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   904
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
   905
	list.Valuate(AIVehicle.GetLocation);
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   906
	print("  Location ListDump:");
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   907
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   908
		print("    " + i + " => " + list.GetValue(i));
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   909
	}
11058
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   910
	print("  foreach():");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   911
	foreach (idx, val in list) {
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   912
		print("    " + idx + " => " + val);
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
   913
	}
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   914
}
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   915
10944
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   916
function Regression::Pathfinder()
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   917
{
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   918
	print("");
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   919
	print("--PathFinder--");
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   920
	print("  Road Between Towns:");
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   921
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   922
	local pathfinder = RPF();
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   923
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   924
	local path = false;
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   925
	pathfinder.InitializePath([AITown.GetLocation(0)], [AITown.GetLocation(1)])
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   926
	while (path == false) path = pathfinder.FindPath(1000);
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   927
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   928
	while (path != null) {
11039
a45899beee2a (svn r13595) [NoAI] -Add [Library CHANGE]: introducing graph.aystar v4 and pathfinder.road v3, allowing directional searches, tweaking those few bad routes into perfect routes (Yexo)
truebrain
parents: 11014
diff changeset
   929
		print("    Tile " + path.GetTile());
10944
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   930
		path = path.GetParent();
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   931
	}
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   932
}
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
   933
10896
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   934
function Regression::QueueTest(queue)
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   935
{
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   936
	print("  Count(): " + queue.Count());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   937
	print("  Peek():  " + queue.Peek());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   938
	print("  Pop():   " + queue.Pop());
10904
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   939
	queue.Insert(6, 20);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   940
	queue.Insert(7, 40);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   941
	queue.Insert(2, 10);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   942
	queue.Insert(5, 15);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   943
	queue.Insert(8, 60);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   944
	queue.Insert(1,  5);
10896
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   945
	queue.Insert(3, 10);
10904
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   946
	queue.Insert(9, 90);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   947
	queue.Insert(4, 10);
10896
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   948
	print("  Count(): " + queue.Count());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   949
	print("  Peek():  " + queue.Peek());
10904
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   950
	for (local i = 4; i > 0; i--) {
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   951
		print("  Pop():   " + queue.Pop());
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   952
	}
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   953
	queue.Insert(1, 5);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   954
	queue.Insert(10, 100);
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   955
	for (local i = queue.Count(); i > 0; i--) {
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   956
		print("  Pop():   " + queue.Pop());
3070af6d1d25 (svn r13455) [NoAI] -Fix: extend the regression to test the queues a bit more
truebrain
parents: 10899
diff changeset
   957
	}
10896
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   958
	print("  Peek():  " + queue.Peek());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   959
	print("  Pop():   " + queue.Pop());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   960
	print("  Count(): " + queue.Count());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   961
}
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   962
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   963
function Regression::Queues()
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   964
{
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   965
	print("");
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   966
	print("--PriorityQueue--");
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   967
	QueueTest(PQ());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   968
	print("");
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   969
	print("--BinaryHeap--");
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   970
	QueueTest(BH());
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   971
}
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
   972
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   973
function Regression::Road()
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   974
{
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   975
	print("");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   976
	print("--Road--");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   977
	print("  Road");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   978
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   979
	print("    BuildRoad():                   " + AIRoad.BuildRoad(0, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   980
	print("    BuildRoad():                   " + AIRoad.BuildRoad(33411, 33411));
10933
57aa2e01942c (svn r13486) [NoAI] -Add: function to determine what TransportTypes a tile holds.
rubidium
parents: 10931
diff changeset
   981
	print("    HasTransportType():            " + AITile.HasTransportType(33413, AITile.TRANSPORT_ROAD));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   982
	print("    BuildRoad():                   " + AIRoad.BuildRoad(33411, 33414));
10933
57aa2e01942c (svn r13486) [NoAI] -Add: function to determine what TransportTypes a tile holds.
rubidium
parents: 10931
diff changeset
   983
	print("    HasTransportType():            " + AITile.HasTransportType(33413, AITile.TRANSPORT_ROAD));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   984
	print("    AreRoadTilesConnected():       " + AIRoad.AreRoadTilesConnected(33412, 33413));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   985
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33411));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   986
	print("    HasRoadType(Road):             " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   987
	print("    HasRoadType(Tram):             " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   988
	print("    GetNeighbourRoadCount():       " + AIRoad.GetNeighbourRoadCount(33412));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   989
	print("    RemoveRoad():                  " + AIRoad.RemoveRoad(33411, 33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   990
	print("    RemoveRoad():                  " + AIRoad.RemoveRoad(33411, 33412));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   991
	print("    RemoveRoad():                  " + AIRoad.RemoveRoad(19590, 19590));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   992
	print("    IsRoadTypeAvailable(Road):     " + AIRoad.IsRoadTypeAvailable(AIRoad.ROADTYPE_ROAD));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   993
	print("    IsRoadTypeAvailable(Tram):     " + AIRoad.IsRoadTypeAvailable(AIRoad.ROADTYPE_TRAM));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   994
	print("    SetCurrentRoadType(Tram):      " + AIRoad.SetCurrentRoadType(AIRoad.ROADTYPE_TRAM));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
   995
	print("    GetCurrentRoadType():          " + AIRoad.GetCurrentRoadType());
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   996
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   997
	print("  Depot");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   998
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
   999
	print("    BuildRoadDepot():              " + AIRoad.BuildRoadDepot(0, 1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1000
	print("    BuildRoadDepot():              " + AIRoad.BuildRoadDepot(33411, 33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1001
	print("    BuildRoadDepot():              " + AIRoad.BuildRoadDepot(33411, 33414));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1002
	print("    BuildRoadDepot():              " + AIRoad.BuildRoadDepot(33411, 33412));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1003
	print("    HasRoadType(Road):             " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1004
	print("    HasRoadType(Tram):             " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
9844
738b8f69675f (svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents: 9834
diff changeset
  1005
	print("    GetLastError():                " + AIError.GetLastError());
738b8f69675f (svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents: 9834
diff changeset
  1006
	print("    GetLastErrorString():          " + AIError.GetLastErrorString());
738b8f69675f (svn r12510) [NoAI] -Add: added AIError, which allows you to catch errors triggered by commands (Morloth)
truebrain
parents: 9834
diff changeset
  1007
	print("    GetErrorCategory():            " + AIError.GetErrorCategory());
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1008
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1009
	print("    GetRoadDepotFrontTile():       " + AIRoad.GetRoadDepotFrontTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1010
	print("    IsRoadDepotTile():             " + AIRoad.IsRoadDepotTile(33411));
9769
015b6674c8ad (svn r12259) [NoAI] -Fix: depots were considered buildable (tnx Progman)
truebrain
parents: 9758
diff changeset
  1011
	print("    IsBuildable():                 " + AITile.IsBuildable(33411));
11053
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1012
	local list = AIDepotList(AITile.TRANSPORT_ROAD);
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1013
	print("    DepotList");
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1014
	print("      Count():                     " + list.Count());
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1015
	list.Valuate(AITile.GetDistanceManhattanToTile, 0);
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1016
	print("      Depot distance from (0,0) ListDump:");
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1017
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1018
		print("        " + i + " => " + list.GetValue(i));
d8d48e076a3f (svn r13610) [NoAI] -Add: AIDepotList giving you a list of the locations of your depots (including hangars).
rubidium
parents: 11039
diff changeset
  1019
	}
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1020
	print("    RemoveRoadDepot():             " + AIRoad.RemoveRoadDepot(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1021
	print("    RemoveRoadDepot():             " + AIRoad.RemoveRoadDepot(33411));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1022
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1023
	print("  Station");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1024
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1025
	print("    BuildRoadStation():            " + AIRoad.BuildRoadStation(0, 1, false, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1026
	print("    BuildRoadStation():            " + AIRoad.BuildRoadStation(33411, 33411, false, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1027
	print("    BuildRoadStation():            " + AIRoad.BuildRoadStation(33411, 33414, false, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1028
	print("    BuildRoadStation():            " + AIRoad.BuildRoadStation(33411, 33412, false, false));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1029
	print("    HasRoadType(Road):             " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1030
	print("    HasRoadType(Tram):             " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1031
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1032
	print("    GetDriveThroughBackTile():     " + AIRoad.GetDriveThroughBackTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1033
	print("    GetRoadStationFrontTile():     " + AIRoad.GetRoadStationFrontTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1034
	print("    IsRoadStationTile():           " + AIRoad.IsRoadStationTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1035
	print("    IsDriveThroughRoadStationTile: " + AIRoad.IsDriveThroughRoadStationTile(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1036
	print("    RemoveRoadStation():           " + AIRoad.RemoveRoadStation(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1037
	print("    RemoveRoadStation():           " + AIRoad.RemoveRoadStation(33411));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1038
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1039
	print("  Station Types");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1040
	print("    BuildRoadStation(bus):         " + AIRoad.BuildRoadStation(33411, 33410, false, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1041
	print("    BuildRoadStation(truck):       " + AIRoad.BuildRoadStation(33421, 33422, true,  false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1042
	print("    BuildRoadStation(truck):       " + AIRoad.BuildRoadStation(33412, 33413, true,  false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1043
	print("    BuildRoadStation(bus):         " + AIRoad.BuildRoadStation(33411 + 256, 33411, false, false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1044
	print("    BuildRoadStation(truck):       " + AIRoad.BuildRoadStation(33412 + 256, 33412 + 256 + 256, true,  false));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1045
	print("    BuildRoadStation(bus-drive):   " + AIRoad.BuildRoadStation(33413, 33412, false, true));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1046
	print("    BuildRoadStation(truck-drive): " + AIRoad.BuildRoadStation(33414, 33413, true,  true));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1047
	print("    BuildRoadStation(bus-drive):   " + AIRoad.BuildRoadStation(33415, 33414, false, true));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1048
	print("    BuildRoadStation(truck-drive): " + AIRoad.BuildRoadStation(33416, 33415, true,  true));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1049
	print("    BuildRoadDepot():              " + AIRoad.BuildRoadDepot(33417, 33418));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1050
	print("    GetRoadStationFrontTile():     " + AIRoad.GetRoadStationFrontTile(33411 + 256));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1051
	print("    GetRoadStationFrontTile():     " + AIRoad.GetRoadStationFrontTile(33412 + 256));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1052
	print("    IsDriveThroughRoadStationTile: " + AIRoad.IsDriveThroughRoadStationTile(33415));
9769
015b6674c8ad (svn r12259) [NoAI] -Fix: depots were considered buildable (tnx Progman)
truebrain
parents: 9758
diff changeset
  1053
	print("    IsBuildable():                 " + AITile.IsBuildable(33415));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1054
	print("    GetDriveThroughBackTile():     " + AIRoad.GetDriveThroughBackTile(33415));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1055
	print("    GetRoadStationFrontTile():     " + AIRoad.GetRoadStationFrontTile(33415));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1056
	print("    IsRoadTile():                  " + AIRoad.IsRoadTile(33415));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1057
}
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1058
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1059
function Regression::Sign()
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1060
{
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1061
	local j = 0;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1062
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1063
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1064
	print("--Sign--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1065
	print("  BuildSign(33410, 'Some Sign'):       " + AISign.BuildSign(33410, "Some Sign"));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1066
	local AISign_id = AISign.BuildSign(33409, "Some other Sign");
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1067
	print("  BuildSign(33409, 'Some other Sign'): " + AISign_id);
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1068
	print("  RemoveSign(" + AISign_id + "):                       " + AISign.RemoveSign(AISign_id));
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1069
	print("");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1070
	print("  GetMaxSignID():    " + AISign.GetMaxSignID());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1071
	for (local i = -1; i < AISign.GetMaxSignID() + 1; i++) {
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1072
		if (AISign.IsValidSign(i)) j++;
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1073
		print("  Sign " + i);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1074
		print("    IsValidSign():   " + AISign.IsValidSign(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1075
		print("    GetText():       " + AISign.GetText(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1076
		print("    GetLocation():   " + AISign.GetLocation(i));
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1077
	}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1078
	print("  Valid Signs:       " + j);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1079
}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1080
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1081
function Regression::Station()
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1082
{
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1083
	print("");
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1084
	print("--Station--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1085
	print("  IsValidStation(0):        " + AIStation.IsValidStation(0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1086
	print("  IsValidStation(1000):     " + AIStation.IsValidStation(1000));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1087
	print("  GetName(0):               " + AIStation.GetName(0));
10381
4ad8b98acd82 (svn r12922) [NoAI] -Add: added AIStation::SetName() (Yexo)
truebrain
parents: 10370
diff changeset
  1088
	print("  SetName(0):               " + AIStation.SetName(0, "Look, a station"));
4ad8b98acd82 (svn r12922) [NoAI] -Add: added AIStation::SetName() (Yexo)
truebrain
parents: 10370
diff changeset
  1089
	print("  GetName(0):               " + AIStation.GetName(0));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1090
	print("  GetLocation(1):           " + AIStation.GetLocation(1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1091
	print("  GetLocation(1000):        " + AIStation.GetLocation(1000));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1092
	print("  GetStationID(33411):      " + AIStation.GetStationID(33411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1093
	print("  GetStationID(34411):      " + AIStation.GetStationID(34411));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1094
	print("  GetCargoWaiting(0, 0):    " + AIStation.GetCargoWaiting(0, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1095
	print("  GetCargoWaiting(1000, 0): " + AIStation.GetCargoWaiting(1000, 0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1096
	print("  GetCargoWaiting(0, 1000): " + AIStation.GetCargoWaiting(0, 1000));
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1097
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1098
	print("  GetStationID(33411):      " + AIStation.GetStationID(33411));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1099
	print("  HasRoadType(3, TRAM):     " + AIStation.HasRoadType(3, AIRoad.ROADTYPE_TRAM));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1100
	print("  HasRoadType(3, ROAD):     " + AIStation.HasRoadType(3, AIRoad.ROADTYPE_ROAD));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1101
	print("  HasRoadType(33411, TRAM): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1102
	print("  HasRoadType(33411, ROAD): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
10863
7b31d67e1553 (svn r13414) [NoAI] -Add: added AIStation::HasStationType(station_id, station_type) to check if a given station has a given station-type
truebrain
parents: 10859
diff changeset
  1103
	print("  HasStationType(3, BUS):   " + AIStation.HasStationType(3, AIStation.STATION_BUS_STOP));
7b31d67e1553 (svn r13414) [NoAI] -Add: added AIStation::HasStationType(station_id, station_type) to check if a given station has a given station-type
truebrain
parents: 10859
diff changeset
  1104
	print("  HasStationType(3, TRAIN): " + AIStation.HasStationType(3, AIStation.STATION_TRAIN));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1105
10863
7b31d67e1553 (svn r13414) [NoAI] -Add: added AIStation::HasStationType(station_id, station_type) to check if a given station has a given station-type
truebrain
parents: 10859
diff changeset
  1106
	print("  GetCoverageRadius(BUS):   " + AIStation.GetCoverageRadius(AIStation.STATION_BUS_STOP));
7b31d67e1553 (svn r13414) [NoAI] -Add: added AIStation::HasStationType(station_id, station_type) to check if a given station has a given station-type
truebrain
parents: 10859
diff changeset
  1107
	print("  GetCoverageRadius(TRUCK): " + AIStation.GetCoverageRadius(AIStation.STATION_TRUCK_STOP));
7b31d67e1553 (svn r13414) [NoAI] -Add: added AIStation::HasStationType(station_id, station_type) to check if a given station has a given station-type
truebrain
parents: 10859
diff changeset
  1108
	print("  GetCoverageRadius(TRAIN): " + AIStation.GetCoverageRadius(AIStation.STATION_TRAIN));
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
  1109
11056
d91b79ffff9c (svn r13613) [NoAI] -Add: added AIStation::GetNearestTown(), which returns the nearest town AT MOMENT OF STATION CREATION (Yexo)
truebrain
parents: 11053
diff changeset
  1110
	print("  GetNearestTown():         " + AIStation.GetNearestTown(0));
d91b79ffff9c (svn r13613) [NoAI] -Add: added AIStation::GetNearestTown(), which returns the nearest town AT MOMENT OF STATION CREATION (Yexo)
truebrain
parents: 11053
diff changeset
  1111
	print("  GetNearestTown():         " + AIStation.GetNearestTown(10000));
d91b79ffff9c (svn r13613) [NoAI] -Add: added AIStation::GetNearestTown(), which returns the nearest town AT MOMENT OF STATION CREATION (Yexo)
truebrain
parents: 11053
diff changeset
  1112
	print("  GetNearestTown():         " + AIStation.GetNearestTown(3));
d91b79ffff9c (svn r13613) [NoAI] -Add: added AIStation::GetNearestTown(), which returns the nearest town AT MOMENT OF STATION CREATION (Yexo)
truebrain
parents: 11053
diff changeset
  1113
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
  1114
	local list = AIStationList(AIStation.STATION_BUS_STOP + AIStation.STATION_TRUCK_STOP);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1115
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1116
	print("");
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1117
	print("--StationList--");
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1118
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1119
	list.Valuate(AIStation.GetLocation);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1120
	print("  Location ListDump:");
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1121
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1122
		print("    " + i + " => " + list.GetValue(i));
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1123
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1124
	list.Valuate(AIStation.GetCargoWaiting, 0);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1125
	print("  CargoWaiting(0) ListDump:");
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1126
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1127
		print("    " + i + " => " + list.GetValue(i));
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1128
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1129
	list.Valuate(AIStation.GetCargoWaiting, 1);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1130
	print("  CargoWaiting(1) ListDump:");
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1131
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1132
		print("    " + i + " => " + list.GetValue(i));
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1133
	}
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1134
}
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1135
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1136
function Regression::TileList()
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1137
{
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1138
	local list = AITileList();
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1139
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1140
	print("");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1141
	print("--TileList--");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1142
	print("  Count():             " + list.Count());
10191
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1143
	list.AddRectangle(27631 - 256 * 1, 256 * 1 + 27631 + 2);
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1144
	print("  Count():             " + list.Count());
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1145
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1146
	list.Valuate(AITile.GetSlope);
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1147
	print("  Slope():             done");
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1148
	print("  Count():             " + list.Count());
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1149
	print("  ListDump:");
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1150
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1151
		print("    " + i + " => " + list.GetValue(i));
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1152
		print("    " + i + " => " + AITile.GetComplementSlope(list.GetValue(i)));
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1153
		print("    " + i + " => " + AITile.IsSteepSlope(list.GetValue(i)));
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1154
		print("    " + i + " => " + AITile.IsHalftileSlope(list.GetValue(i)));
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1155
	}
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1156
	list.Clear();
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1157
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1158
	print("");
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1159
	print("--TileList--");
da75d1460a4b (svn r12722) [NoAI] -Add (or -Feature for yorick): added AITile::IsSteepSlope(), AITile::IsHalftileSlope() and AITile::GetComplementSlope()
truebrain
parents: 10187
diff changeset
  1160
	print("  Count():             " + list.Count());
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1161
	list.AddRectangle(41895 - 256 * 2, 256 * 2 + 41895 + 8);
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1162
	print("  Count():             " + list.Count());
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1163
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1164
	list.Valuate(AITile.GetHeight);
9700
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1165
	print("  Height():            done");
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1166
	print("  Count():             " + list.Count());
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1167
	print("  ListDump:");
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1168
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1169
		print("    " + i + " => " + list.GetValue(i));
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1170
	}
e442ce398e83 (svn r10941) [NoAI] -Add: added AITile::GetHeight and AITileList valuator Height
truelight
parents: 9699
diff changeset
  1171
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1172
	list.Valuate(AITile.GetSlope);
9611
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1173
	list.KeepValue(0);
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1174
	print("  Slope():             done");
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1175
	print("  KeepValue(0):        done");
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1176
	print("  Count():             " + list.Count());
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1177
	print("  ListDump:");
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1178
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1179
		print("    " + i + " => " + list.GetValue(i));
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1180
	}
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
  1181
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1182
	list.Valuate(AITile.IsBuildable);
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1183
	list.KeepValue(1);
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1184
	print("  Buildable():         done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1185
	print("  KeepValue(1):        done");
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1186
	print("  Count():             " + list.Count());
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1187
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1188
	list.Valuate(AITile.IsBuildableRectangle, 3, 3);
9657
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
  1189
	print("  BuildableRectangle(3, 3) ListDump:");
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
  1190
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
  1191
		print("    " + i + " => " + list.GetValue(i));
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
  1192
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1193
	list.Valuate(AITile.GetDistanceManhattanToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1194
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1195
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1196
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1197
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1198
	list.Valuate(AITile.GetDistanceSquareToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1199
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1200
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1201
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1202
	}
10360
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1203
	list.Valuate(AITile.GetOwner);
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1204
	print("  GetOwner() ListDump:");
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1205
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1206
		print("    " + i + " => " + list.GetValue(i));
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1207
	}
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1208
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1209
	list.Valuate(AITile.GetCargoAcceptance, 0, 1, 1, 3);
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1210
	list.KeepAboveValue(10);
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1211
	print("  CargoAcceptance():   done");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1212
	print("  KeepAboveValue(10):  done");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1213
	print("  Count():             " + list.Count());
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1214
	print("  ListDump:");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1215
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1216
		print("    " + i + " => " + list.GetValue(i));
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1217
	}
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1218
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1219
	list.Valuate(AIRoad.IsRoadTile);
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1220
	list.KeepValue(1);
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1221
	print("  RoadTile():          done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1222
	print("  KeepValue(1):        done");
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1223
	print("  Count():             " + list.Count());
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1224
	print("  ListDump:");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1225
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1226
		print("    " + i + " => " + list.GetValue(i));
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1227
	}
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1228
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1229
	list.Valuate(AIRoad.GetNeighbourRoadCount);
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
  1230
	list.KeepValue(1);
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
  1231
	print("  NeighbourRoadCount():done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
  1232
	print("  KeepValue(1):        done");
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1233
	print("  Count():             " + list.Count());
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1234
	print("  ListDump:");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1235
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1236
		print("    " + i + " => " + list.GetValue(i));
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1237
	}
9698
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1238
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1239
	list.AddRectangle(54421 - 256 * 2, 256 * 2 + 54421 + 8);
10931
df70e29d4c23 (svn r13484) [NoAI] -Fix [API CHANGE]: AITile::IsBuildable() now returns 'true' on coast tiles
truebrain
parents: 10918
diff changeset
  1240
	list.Valuate(AITile.IsWaterTile);
9698
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1241
	print("  Water():             done");
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1242
	print("  Count():             " + list.Count());
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1243
	print("  ListDump:");
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1244
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1245
		print("    " + i + " => " + list.GetValue(i));
1d50fe99b7e9 (svn r10939) [NoAI] -Add: added AITileList valuator Water
truelight
parents: 9696
diff changeset
  1246
	}
9758
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1247
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1248
	local list = AITileList_IndustryAccepting(0, 3);
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1249
	print("");
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1250
	print("--TileList_IndustryAccepting--");
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1251
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1252
	list.Valuate(AITile.GetCargoAcceptance, 3, 1, 1, 3);
9758
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1253
	print("  Location ListDump:");
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1254
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1255
		print("    " + i + " => " + list.GetValue(i));
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1256
	}
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1257
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1258
	local list = AITileList_IndustryProducing(1, 3);
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1259
	print("");
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1260
	print("--TileList_IndustryProducing--");
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1261
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1262
	list.Valuate(AITile.GetCargoProduction, 7, 1, 1, 3);
9758
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1263
	print("  Location ListDump:");
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1264
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1265
		print("    " + i + " => " + list.GetValue(i));
f01f3df7cfbe (svn r12243) [NoAI] -Fix r12242: move the regression-test for AITileList_Industry* to TileList(), and show that they really work by using the Valuators to proof that
truebrain
parents: 9757
diff changeset
  1266
	}
10864
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1267
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1268
	local list = AITileList_StationType(3, AIStation.STATION_BUS_STOP);
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1269
	print("");
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1270
	print("--TileList_StationType--");
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1271
	print("  Count():             " + list.Count());
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1272
	print("  Location ListDump:");
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1273
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1274
		print("    " + i + " => " + list.GetValue(i));
9a6616a1dce6 (svn r13415) [NoAI] -Add: added AITileList_StationType, giving all the tiles on which a station of your requested type is, for a given station
truebrain
parents: 10863
diff changeset
  1275
	}
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1276
}
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1277
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1278
function Regression::Town()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1279
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1280
	local j = 0;
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1281
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1282
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1283
	print("--Town--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1284
	print("  GetMaxTownID():    " + AITown.GetMaxTownID());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1285
	print("  GetTownCount():    " + AITown.GetTownCount());
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1286
	for (local i = -1; i < AITown.GetMaxTownID() + 1; i++) {
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1287
		if (AITown.IsValidTown(i)) j++;
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1288
		print("  Town " + i);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1289
		print("    IsValidTown():   " + AITown.IsValidTown(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1290
		print("    GetName():       " + AITown.GetName(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1291
		print("    GetPopulation(): " + AITown.GetPopulation(i));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1292
		print("    GetLocation():   " + AITown.GetLocation(i));
10844
affb2821fb9f (svn r13395) [NoAI] -Fix [API CHANGE]: Rename AIOrder::GetNumberOfORders to AIOrder::GetOrderCount
truebrain
parents: 10831
diff changeset
  1293
		print("    GetHouseCount(): " + AITown.GetHouseCount(i));
10869
4fdb11e1b599 (svn r13420) [NoAI] -Add: function to get the town rating.
rubidium
parents: 10864
diff changeset
  1294
		print("    GetRating():     " + AITown.GetRating(i, AICompany.MY_COMPANY));
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1295
	}
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1296
	print("  Valid Towns:       " + j);
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1297
	print("  GetTownCount():    " + AITown.GetTownCount());
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1298
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1299
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1300
function Regression::TownList()
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1301
{
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1302
	local list = AITownList();
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1303
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1304
	print("");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1305
	print("--TownList--");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1306
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1307
	list.Valuate(AITown.GetLocation);
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
  1308
	print("  Location ListDump:");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
  1309
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
  1310
		print("    " + i + " => " + list.GetValue(i));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
  1311
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1312
	list.Valuate(AITown.GetDistanceManhattanToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1313
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1314
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1315
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1316
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1317
	list.Valuate(AITown.GetDistanceSquareToTile, 30000);
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1318
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1319
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1320
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
  1321
	}
10361
4cdffd48480f (svn r12902) [NoAI] -Fix r12901 [API CHANGE]: renamed IsWithinTownRadius to IsWithinTownInfluence, as that reflects the meaning much better
truebrain
parents: 10360
diff changeset
  1322
	list.Valuate(AITown.IsWithinTownInfluence, AITown.GetLocation(0));
4cdffd48480f (svn r12902) [NoAI] -Fix r12901 [API CHANGE]: renamed IsWithinTownRadius to IsWithinTownInfluence, as that reflects the meaning much better
truebrain
parents: 10360
diff changeset
  1323
	print("  IsWithinTownInfluence(" + AITown.GetLocation(0) + ") ListDump:");
10360
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1324
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1325
		print("    " + i + " => " + list.GetValue(i));
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1326
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1327
	list.Valuate(AITown.GetPopulation);
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1328
	list.KeepAboveValue(500);
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1329
	print("  KeepAboveValue(500): done");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1330
	print("  Count():             " + list.Count());
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
  1331
	print("  Population ListDump:");
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1332
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1333
		print("    " + i + " => " + list.GetValue(i));
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1334
	}
10859
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1335
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1336
	print("  HasStatue():                     " + AITown.HasStatue(list.Begin()));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1337
	print("  GetRoadReworkDuration():         " + AITown.GetRoadReworkDuration(list.Begin()));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1338
	print("  GetExclusiveRightsPlayer():      " + AITown.GetExclusiveRightsPlayer(list.Begin()));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1339
	print("  GetExclusiveRightsDuration():    " + AITown.GetExclusiveRightsDuration(list.Begin()));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1340
	print("  IsActionAvailable(BUILD_STATUE): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1341
	print("  PerformTownAction(BUILD_STATUE): " + AITown.PerformTownAction(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1342
	print("  IsActionAvailable(BUILD_STATUE): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1343
	print("  HasStatue():                     " + AITown.HasStatue(list.Begin()));
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1344
}
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1345
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1346
function Regression::Tunnel()
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1347
{
10859
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1348
	print("");
4c14a8041c0a (svn r13410) [NoAI] -Add: functions to perform town actions (advertising, bribing, building statues, etc).
rubidium
parents: 10856
diff changeset
  1349
	print("--Tunnel--");
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1350
	print("  IsTunnelTile():       " + AITunnel.IsTunnelTile(29050));
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1351
	print("  RemoveTunnel():       " + AITunnel.RemoveTunnel(29050));
9807
5b3be41b3ce6 (svn r12315) [NoAI] -Fix: AITunnel::GetOtherTunnelEnd() now also works to estimate where a non-existing tunnel would end (Morloth / glx)
truebrain
parents: 9806
diff changeset
  1352
	print("  GetOtherTunnelEnd():  " + AITunnel.GetOtherTunnelEnd(29050));
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1353
	print("  BuildTunnel():        " + AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, 29050));
9807
5b3be41b3ce6 (svn r12315) [NoAI] -Fix: AITunnel::GetOtherTunnelEnd() now also works to estimate where a non-existing tunnel would end (Morloth / glx)
truebrain
parents: 9806
diff changeset
  1354
	print("  GetOtherTunnelEnd():  " + AITunnel.GetOtherTunnelEnd(29050));
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1355
	print("  IsTunnelTile():       " + AITunnel.IsTunnelTile(29050));
9807
5b3be41b3ce6 (svn r12315) [NoAI] -Fix: AITunnel::GetOtherTunnelEnd() now also works to estimate where a non-existing tunnel would end (Morloth / glx)
truebrain
parents: 9806
diff changeset
  1356
	print("  IsTunnelTile():       " + AITunnel.IsTunnelTile(28026));
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1357
	print("  RemoveTunnel():       " + AITunnel.RemoveTunnel(29050));
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1358
	print("  IsTunnelTile():       " + AITunnel.IsTunnelTile(29050));
10088
922c6e6a8d3e (svn r12612) [NoAI] -Add: support for GetLastError for AITunnel. Patch by Morloth.
rubidium
parents: 10086
diff changeset
  1359
922c6e6a8d3e (svn r12612) [NoAI] -Add: support for GetLastError for AITunnel. Patch by Morloth.
rubidium
parents: 10086
diff changeset
  1360
	print("  --Errors--");
922c6e6a8d3e (svn r12612) [NoAI] -Add: support for GetLastError for AITunnel. Patch by Morloth.
rubidium
parents: 10086
diff changeset
  1361
	print("  BuildTunnel():        " + AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, 7529));
922c6e6a8d3e (svn r12612) [NoAI] -Add: support for GetLastError for AITunnel. Patch by Morloth.
rubidium
parents: 10086
diff changeset
  1362
	print("  BuildTunnel():        " + AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, 8043));
922c6e6a8d3e (svn r12612) [NoAI] -Add: support for GetLastError for AITunnel. Patch by Morloth.
rubidium
parents: 10086
diff changeset
  1363
	print("  GetLastErrorString(): " + AIError.GetLastErrorString());
922c6e6a8d3e (svn r12612) [NoAI] -Add: support for GetLastError for AITunnel. Patch by Morloth.
rubidium
parents: 10086
diff changeset
  1364
	print("  RemoveTunnel():       " + AITunnel.RemoveTunnel(7529));
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1365
}
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1366
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1367
function Regression::Vehicle()
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1368
{
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1369
	local accounting = AIAccounting();
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1370
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1371
	print("");
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1372
	print("--Vehicle--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1373
	print("  IsValidVehicle(-1):   " + AIVehicle.IsValidVehicle(-1));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1374
	print("  IsValidVehicle(0):    " + AIVehicle.IsValidVehicle(0));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1375
	print("  IsValidVehicle(11):   " + AIVehicle.IsValidVehicle(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1376
	print("  ISValidVehicle(9999): " + AIVehicle.IsValidVehicle(9999));
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1377
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1378
	local bank = AICompany.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1379
9560
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1380
	{
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1381
		local transaction = AITransactionMode();
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1382
		print("  BuildVehicle():       " + AIVehicle.BuildVehicle(33417, 153));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1383
		print("  IsValidVehicle(11):   " + AIVehicle.IsValidVehicle(11));
9560
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1384
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1385
		print("  --Transaction--");
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1386
		print("    GetCosts():         " + transaction.GetCosts());
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1387
		print("    Execute():          " + transaction.Execute());
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1388
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1389
		print("  IsValidVehicle(11):   " + AIVehicle.IsValidVehicle(11));
9560
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
  1390
	}
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1391
	print("  CloneVehicle():       " + AIVehicle.CloneVehicle(33417, 11, true));
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1392
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1393
	local bank_after = AICompany.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1394
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1395
	print("  --Accounting--");
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1396
	print("    GetCosts():         " + accounting.GetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1397
	print("    Should be:          " + (bank - bank_after));
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1398
	print("    ResetCosts():       " + accounting.ResetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1399
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1400
	bank = AICompany.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1401
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1402
	print("  SellVehicle(12):      " + AIVehicle.SellVehicle(12));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1403
	print("  IsInDepot():          " + AIVehicle.IsInDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1404
	print("  IsStoppedInDepot():   " + AIVehicle.IsStoppedInDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1405
	print("  StartStopVehicle():   " + AIVehicle.StartStopVehicle(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1406
	print("  IsInDepot():          " + AIVehicle.IsInDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1407
	print("  IsStoppedInDepot():   " + AIVehicle.IsStoppedInDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1408
	print("  SendVehicleToDepot(): " + AIVehicle.SendVehicleToDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1409
	print("  IsInDepot():          " + AIVehicle.IsInDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1410
	print("  IsStoppedInDepot():   " + AIVehicle.IsStoppedInDepot(11));
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1411
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1412
	bank_after = AICompany.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1413
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1414
	print("  --Accounting--");
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1415
	print("    GetCosts():         " + accounting.GetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1416
	print("    Should be:          " + (bank - bank_after));
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
  1417
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1418
	print("  GetName():            " + AIVehicle.GetName(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1419
	print("  SetName():            " + AIVehicle.SetName(11, "MyVehicleName"));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1420
	print("  GetName():            " + AIVehicle.GetName(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1421
	print("  CloneVehicle():       " + AIVehicle.CloneVehicle(33417, 11, true));
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1422
9615
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
  1423
	print("  --VehicleData--");
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1424
	print("    GetLocation():       " + AIVehicle.GetLocation(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1425
	print("    GetEngineType():     " + AIVehicle.GetEngineType(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1426
	print("    GetUnitNumber():     " + AIVehicle.GetUnitNumber(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1427
	print("    GetAge():            " + AIVehicle.GetAge(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1428
	print("    GetMaxAge():         " + AIVehicle.GetMaxAge(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1429
	print("    GetAgeLeft():        " + AIVehicle.GetAgeLeft(11));
10187
d5a6eba5af45 (svn r12718) [NoAI] -Add: added AIVehicle::GetCurrentSpeed
truebrain
parents: 10088
diff changeset
  1430
	print("    GetCurrentSpeed():   " + AIVehicle.GetCurrentSpeed(11));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1431
	print("    GetRunningCost():    " + AIVehicle.GetRunningCost(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1432
	print("    GetProfitThisYear(): " + AIVehicle.GetProfitThisYear(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1433
	print("    GetProfitLastYear(): " + AIVehicle.GetProfitLastYear(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1434
	print("    GetVehicleType():    " + AIVehicle.GetVehicleType(11));
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1435
	print("    GetRoadType():       " + AIVehicle.GetRoadType(11));
10193
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1436
	print("    GetCapacity():       " + AIVehicle.GetCapacity(11, 10));
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1437
	print("    GetCargoLoad():      " + AIVehicle.GetCargoLoad(11, 10));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1438
	print("    IsInDepot():         " + AIVehicle.IsInDepot(11));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1439
	print("    IsStoppedInDepot():  " + AIVehicle.IsStoppedInDepot(11));
9615
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
  1440
10360
3234cb59de55 (svn r12901) [NoAI] -Add: added AITown.IsWithinTownRadius, AIStation.IsWithinTownRadius and AITile.GetOwner (Yexo)
truebrain
parents: 10344
diff changeset
  1441
	print("  GetOwner():           " + AITile.GetOwner(32119));
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1442
	print("  BuildVehicle():       " + AIVehicle.BuildVehicle(32119, 219));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1443
	print("  IsValidVehicle(13):   " + AIVehicle.IsValidVehicle(13));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1444
	print("  IsInDepot(13):        " + AIVehicle.IsInDepot(13));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1445
	print("  IsStoppedInDepot(13): " + AIVehicle.IsStoppedInDepot(13));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1446
	print("  IsValidVehicle(14):   " + AIVehicle.IsValidVehicle(14));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1447
	print("  IsInDepot(14):        " + AIVehicle.IsInDepot(14));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1448
	print("  IsStoppedInDepot(14): " + AIVehicle.IsStoppedInDepot(14));
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
  1449
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1450
	print("  BuildVehicle():       " + AIVehicle.BuildVehicle(28479, 204));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1451
	print("  IsValidVehicle(15):   " + AIVehicle.IsValidVehicle(15));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1452
	print("  IsInDepot(15):        " + AIVehicle.IsInDepot(15));
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9733
diff changeset
  1453
	print("  IsStoppedInDepot(15): " + AIVehicle.IsStoppedInDepot(15));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
  1454
9874
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1455
	print("  --Errors--");
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1456
	print("    RefitVehicle():        " + AIVehicle.RefitVehicle(11, 0));
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1457
	print("    GetLastErrorString():  " + AIError.GetLastErrorString());
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1458
	print("    SellVehicle():         " + AIVehicle.SellVehicle(11));
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1459
	print("    GetLastErrorString():  " + AIError.GetLastErrorString());
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1460
	print("    SendVehicleToDepot():  " + AIVehicle.SendVehicleToDepot(12));
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1461
	print("    GetLastErrorString():  " + AIError.GetLastErrorString());
4ecef0dadf01 (svn r12607) [NoAI] -Add: SetLastError support for AIVehicle (Morloth)
truebrain
parents: 9867
diff changeset
  1462
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1463
	local list = AIVehicleList();
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1464
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1465
	print("");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1466
	print("--VehicleList--");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1467
	print("  Count():             " + list.Count());
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1468
	list.Valuate(AIVehicle.GetLocation);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1469
	print("  Location ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1470
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1471
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1472
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1473
	list.Valuate(AIVehicle.GetEngineType);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1474
	print("  EngineType ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1475
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1476
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1477
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1478
	list.Valuate(AIVehicle.GetUnitNumber);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1479
	print("  UnitNumber ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1480
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1481
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1482
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1483
	list.Valuate(AIVehicle.GetAge);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1484
	print("  Age ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1485
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1486
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1487
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1488
	list.Valuate(AIVehicle.GetMaxAge);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1489
	print("  MaxAge ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1490
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1491
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1492
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1493
	list.Valuate(AIVehicle.GetAgeLeft);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1494
	print("  AgeLeft ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1495
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1496
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1497
	}
10187
d5a6eba5af45 (svn r12718) [NoAI] -Add: added AIVehicle::GetCurrentSpeed
truebrain
parents: 10088
diff changeset
  1498
	list.Valuate(AIVehicle.GetCurrentSpeed);
d5a6eba5af45 (svn r12718) [NoAI] -Add: added AIVehicle::GetCurrentSpeed
truebrain
parents: 10088
diff changeset
  1499
	print("  CurrentSpeed ListDump:");
d5a6eba5af45 (svn r12718) [NoAI] -Add: added AIVehicle::GetCurrentSpeed
truebrain
parents: 10088
diff changeset
  1500
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
d5a6eba5af45 (svn r12718) [NoAI] -Add: added AIVehicle::GetCurrentSpeed
truebrain
parents: 10088
diff changeset
  1501
		print("    " + i + " => " + list.GetValue(i));
d5a6eba5af45 (svn r12718) [NoAI] -Add: added AIVehicle::GetCurrentSpeed
truebrain
parents: 10088
diff changeset
  1502
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1503
	list.Valuate(AIVehicle.GetRunningCost);
9806
d65cc2bcb0de (svn r12312) [NoAI] -Fix: AIVehicle_vRunningCost didn't exist
truebrain
parents: 9801
diff changeset
  1504
	print("  RunningCost ListDump:");
d65cc2bcb0de (svn r12312) [NoAI] -Fix: AIVehicle_vRunningCost didn't exist
truebrain
parents: 9801
diff changeset
  1505
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
d65cc2bcb0de (svn r12312) [NoAI] -Fix: AIVehicle_vRunningCost didn't exist
truebrain
parents: 9801
diff changeset
  1506
		print("    " + i + " => " + list.GetValue(i));
d65cc2bcb0de (svn r12312) [NoAI] -Fix: AIVehicle_vRunningCost didn't exist
truebrain
parents: 9801
diff changeset
  1507
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1508
	list.Valuate(AIVehicle.GetProfitThisYear);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1509
	print("  ProfitThisYear ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1510
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1511
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1512
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1513
	list.Valuate(AIVehicle.GetProfitLastYear);
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1514
	print("  ProfitLastYear ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1515
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1516
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
  1517
	}
9814
be51ea0adc29 (svn r12411) [NoAI] -Change [API CHANGE]: order of params of CargoIncome is changed
truebrain
parents: 9810
diff changeset
  1518
	list.Valuate(AIVehicle.GetVehicleType);
9684
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
  1519
	print("  VehicleType ListDump:");
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
  1520
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
  1521
		print("    " + i + " => " + list.GetValue(i));
623970482fb2 (svn r10633) [NoAI] -Add: added GetVehicleType and AIVehicle::VehicleType
truelight
parents: 9682
diff changeset
  1522
	}
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1523
	list.Valuate(AIVehicle.GetRoadType);
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1524
	print("  RoadType ListDump:");
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1525
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1526
		print("    " + i + " => " + list.GetValue(i));
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10650
diff changeset
  1527
	}
10193
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1528
	list.Valuate(AIVehicle.GetCapacity, 10);
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1529
	print("  VehicleType ListDump:");
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1530
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1531
		print("    " + i + " => " + list.GetValue(i));
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1532
	}
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1533
	list.Valuate(AIVehicle.GetCargoLoad, 10);
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1534
	print("  VehicleType ListDump:");
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1535
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1536
		print("    " + i + " => " + list.GetValue(i));
9f73edc0c57a (svn r12724) [NoAI] -Fix r12720: also add regression test for new functions
truebrain
parents: 10191
diff changeset
  1537
	}
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1538
}
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1539
10344
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1540
function Regression::PrintSubsidy(subsidy_id)
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1541
{
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1542
	print("      --Subsidy (" + subsidy_id + ") --");
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1543
	print("        IsValidSubsidy():     " + AISubsidy.IsValidSubsidy(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1544
	print("        IsAwarded():          " + AISubsidy.IsAwarded(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1545
	print("        GetAwardedTo():       " + AISubsidy.GetAwardedTo(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1546
	print("        GetExpireDate():      " + AISubsidy.GetExpireDate(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1547
	print("        SourceIsTown():       " + AISubsidy.SourceIsTown(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1548
	print("        GetSource():          " + AISubsidy.GetSource(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1549
	print("        DestionationIsTown(): " + AISubsidy.DestinationIsTown(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1550
	print("        GetDestionation():    " + AISubsidy.GetDestination(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1551
	print("        GetCargoType():       " + AISubsidy.GetCargoType(subsidy_id));
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1552
}
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1553
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1554
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1555
function Regression::Start()
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1556
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1557
	this.TestInit();
9487
0575126e0267 (svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents: 9485
diff changeset
  1558
	this.Std();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1559
	this.Base();
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
  1560
	this.List();
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
  1561
	this.Airport();
9792
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
  1562
	this.Bridge();
e1222f4674c2 (svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents: 9791
diff changeset
  1563
	this.BridgeList();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1564
	this.Cargo();
9785
edbd185e05ed (svn r12280) [NoAI] -Add: added AICargoList (Morloth)
truebrain
parents: 9776
diff changeset
  1565
	this.CargoList();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1566
	this.Company();
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents: 9710
diff changeset
  1567
	this.Engine();
9714
fdbdae7ea647 (svn r11298) [NoAI] -Add: added EngineList + Valuators for all common functions. This should replace all FindXXXEngine, which will be removed soon
truelight
parents: 9713
diff changeset
  1568
	this.EngineList();
9682
d031eb183733 (svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
truelight
parents: 9672
diff changeset
  1569
	this.Event();
10910
85f71706f496 (svn r13461) [NoAI] -Fix: add A* to regression, so we test it a bit (very basic test ;))
truebrain
parents: 10904
diff changeset
  1570
	this.Graph();
11057
188a9ca6d8de (svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents: 11056
diff changeset
  1571
	this.Group();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1572
	this.Industry();
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
  1573
	this.IndustryList();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1574
	this.Map();
9691
1231d4e5f5aa (svn r10679) [NoAI] -Add: added AIMarine, which takes care of Ships, Docks, ...
truelight
parents: 9684
diff changeset
  1575
	this.Marine();
10944
588393239ac6 (svn r13498) [NoAI] -Add: added 'pathfinder.road' to the regression
truebrain
parents: 10938
diff changeset
  1576
	this.Pathfinder();
10896
6bb839ed0002 (svn r13447) [NoAI] -Add [Library]: Binary Heap ( O(ln n) insert/pop )
truebrain
parents: 10889
diff changeset
  1577
	this.Queues();
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
  1578
	this.Road();
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
  1579
	this.Sign();
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
  1580
	this.Station();
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
  1581
	this.TileList();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1582
	this.Town();
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
  1583
	this.TownList();
9794
5d866d7cb991 (svn r12298) [NoAI] -Add: added AITunnel (Morloth)
truebrain
parents: 9793
diff changeset
  1584
	this.Tunnel();
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
  1585
	this.Vehicle();
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
  1586
	/* Order has to be after Vehicle */
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
  1587
	this.Order();
11058
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
  1588
	print("");
3305a425f55b (svn r13615) [NoAI] -Fix: fixed most, if not all, problems around AIAbstractList. It is now safe to remove values while looping, among other things.
truebrain
parents: 11057
diff changeset
  1589
	print("  First Subsidy Test");
10344
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1590
	PrintSubsidy(0);
9823
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1591
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1592
	/* Sleep now, to give time for events to happen */
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1593
	Sleep(4000);
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1594
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1595
	while (AIEventController.IsEventWaiting()) {
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1596
		local e = AIEventController.GetNextEvent();
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1597
		print("  GetNextEvent:          " + (e == null ? "null" : "instance"));
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1598
		print("    GetEventType:        " + e.GetEventType());
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1599
		switch (e.GetEventType()) {
10086
6497ef78f031 (svn r12610) [NoAI] -Fix: a subsidiary is a 'subcompany' and not the financial bonus for routes which is called a subsidy.
rubidium
parents: 9874
diff changeset
  1600
			case AIEvent.AI_ET_SUBSIDY_OFFER:
6497ef78f031 (svn r12610) [NoAI] -Fix: a subsidiary is a 'subcompany' and not the financial bonus for routes which is called a subsidy.
rubidium
parents: 9874
diff changeset
  1601
				local c = AIEventSubsidyOffer.Convert(e);
6497ef78f031 (svn r12610) [NoAI] -Fix: a subsidiary is a 'subcompany' and not the financial bonus for routes which is called a subsidy.
rubidium
parents: 9874
diff changeset
  1602
				print("      EventName:         SubsidyOffer");
10344
b7e9f5c65e30 (svn r12885) [NoAI] -Add: added AISubsidy and AIEventSubsidyNNN (Yexo)
truebrain
parents: 10291
diff changeset
  1603
				PrintSubsidy(c.GetSubsidyID());
9823
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1604
				break;
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1605
10370
fa4f88090694 (svn r12911) [NoAI] -Add: added AIEventVehicle(List|WaitingInDepot|Unprofitable) (Yexo)
truebrain
parents: 10361
diff changeset
  1606
			case AIEvent.AI_ET_VEHICLE_WAITING_IN_DEPOT:
fa4f88090694 (svn r12911) [NoAI] -Add: added AIEventVehicle(List|WaitingInDepot|Unprofitable) (Yexo)
truebrain
parents: 10361
diff changeset
  1607
				local c = AIEventVehicleWaitingInDepot.Convert(e);
fa4f88090694 (svn r12911) [NoAI] -Add: added AIEventVehicle(List|WaitingInDepot|Unprofitable) (Yexo)
truebrain
parents: 10361
diff changeset
  1608
				print("      EventName:         VehicleWaitingInDepot");
fa4f88090694 (svn r12911) [NoAI] -Add: added AIEventVehicle(List|WaitingInDepot|Unprofitable) (Yexo)
truebrain
parents: 10361
diff changeset
  1609
				print("      VehicleID:         " + c.GetVehicleID());
fa4f88090694 (svn r12911) [NoAI] -Add: added AIEventVehicle(List|WaitingInDepot|Unprofitable) (Yexo)
truebrain
parents: 10361
diff changeset
  1610
				break;
fa4f88090694 (svn r12911) [NoAI] -Add: added AIEventVehicle(List|WaitingInDepot|Unprofitable) (Yexo)
truebrain
parents: 10361
diff changeset
  1611
9823
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1612
			default:
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1613
				print("      Unknown Event");
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1614
				break;
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1615
		}
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1616
	}
0b7f816cf46f (svn r12431) [NoAI] -Add: added AIEventSubsidiaryOffer, which keeps you informed about new Subsidiaries
truebrain
parents: 9814
diff changeset
  1617
	print("  IsEventWaiting:        false");
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1618
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
  1619