bin/ai/regression/regression.nut
author truelight
Fri, 13 Jul 2007 11:04:00 +0000
branchnoai
changeset 9647 c17046b1b8a2
parent 9645 25126afa0c25
child 9648 760b7b504e37
permissions -rw-r--r--
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
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
     1
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
     2
	stop     = false;
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
     3
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
     4
	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
     5
	function Stop();
9461
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents: 9460
diff changeset
     6
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents: 9460
diff changeset
     7
	constructor() {	}
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
     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
{
9553
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
    14
	local settings = AISettings();
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
    15
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
    16
	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
    17
	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
    18
	print(" TickTest: " + this.GetTick());
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
    19
	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
    20
	print(" TickTest: " + this.GetTick());
9553
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
    21
	print(" SetCommandDelay: " + settings.SetCommandDelay(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
    22
}
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
    23
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
    24
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
    25
{
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
    26
	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
    27
	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
    28
	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
    29
	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
    30
}
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
    31
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
    32
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
    33
{
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
    34
	local base = AIBase();
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
    35
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
    36
	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
    37
	print("--AIBase--");
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
    38
	print("  Rand():       " + base.Rand());
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
    39
	print("  Rand():       " + base.Rand());
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
    40
	print("  Rand():       " + base.Rand());
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
    41
	print("  RandRange(0): " + base.RandRange(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
    42
	print("  RandRange(0): " + base.RandRange(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
    43
	print("  RandRange(0): " + base.RandRange(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
    44
	print("  RandRange(1): " + base.RandRange(1));
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
    45
	print("  RandRange(1): " + base.RandRange(1));
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
    46
	print("  RandRange(1): " + base.RandRange(1));
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
    47
	print("  RandRange(2): " + base.RandRange(2));
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
    48
	print("  RandRange(2): " + base.RandRange(2));
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
    49
	print("  RandRange(2): " + base.RandRange(2));
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
    50
	print("  RandRange(9): " + base.RandRange(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
    51
	print("  RandRange(9): " + base.RandRange(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
    52
	print("  RandRange(9): " + base.RandRange(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
    53
	print("  Chance(1, 2): " + base.Chance(1, 2));
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
    54
	print("  Chance(1, 2): " + base.Chance(1, 2));
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
    55
	print("  Chance(1, 2): " + base.Chance(1, 2));
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
    56
}
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
    57
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
    58
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
    59
{
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
    60
	local cargo = 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
    61
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
    62
	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
    63
	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
    64
	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
    65
		print("  Cargo " + i);
9553
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
    66
		print("    IsValidCargo():          " + cargo.IsValidCargo(i));
9461
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents: 9460
diff changeset
    67
		print("    GetCargoLabel():         '" + cargo.GetCargoLabel(i)+ "'");
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
    68
		print("    IsFreight():             " + cargo.IsFreight(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
    69
		print("    GetCargoIncome(0, 0):    " + cargo.GetCargoIncome(0, 0, 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
    70
		print("    GetCargoIncome(10, 10):  " + cargo.GetCargoIncome(10, 10, 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
    71
		print("    GetCargoIncome(100, 10): " + cargo.GetCargoIncome(100, 10, 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
    72
		print("    GetCargoIncome(10, 100): " + cargo.GetCargoIncome(10, 100, 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
    73
	}
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
    74
}
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
    75
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
    76
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
    77
{
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
    78
	local company = AICompany();
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
    79
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
    80
	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
    81
	print("--Company--");
9558
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    82
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    83
	/* Test AIXXXMode() in scopes */
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    84
	{
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    85
		local test = AITestMode();
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    86
		print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    87
		print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    88
		{
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    89
			local exec = AIExecMode();
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    90
			print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    91
			print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    92
		}
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    93
	}
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
    94
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
    95
	print("  GetCompanyName():     " + company.GetCompanyName());
9575
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9560
diff changeset
    96
	print("  GetPresidentName():   " + company.GetPresidentName());
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9560
diff changeset
    97
	print("  SetPresidentName():   " + company.SetPresidentName("Regression AI"));
a4b6bbfa6c96 (svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents: 9560
diff changeset
    98
	print("  GetPresidentName():   " + company.GetPresidentName());
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
    99
	print("  GetCompanyValue():    " + company.GetCompanyValue());
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
   100
	print("  GetBankBalance():     " + company.GetBankBalance());
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
   101
	print("  GetLoanAmount():      " + company.GetLoanAmount());
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
   102
	print("  GetMaxLoanAmount():   " + company.GetMaxLoanAmount());
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
   103
	print("  GetLoanInterval():    " + company.GetLoanInterval());
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
   104
	print("  SetLoanAmount(1):     " + company.SetLoanAmount(1));
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
   105
	print("  SetLoanAmount(100):   " + company.SetLoanAmount(100));
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
   106
	print("  SetLoanAmount(10000): " + company.SetLoanAmount(10000));
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
   107
	print("  GetBankBalance():     " + company.GetBankBalance());
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
   108
	print("  GetLoanAmount():      " + company.GetLoanAmount());
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
   109
	print("  SetLoanAmount(10000): " + company.SetLoanAmount(company.GetMaxLoanAmount()));
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
   110
	print("  GetBankBalance():     " + company.GetBankBalance());
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
   111
	print("  GetLoanAmount():      " + company.GetLoanAmount());
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
   112
}
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
   113
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
   114
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
   115
{
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
   116
	local industry = AIIndustry();
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
   117
	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
   118
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
   119
	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
   120
	print("--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
   121
	print("  GetMaxIndustryID():  " + industry.GetMaxIndustryID());
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
   122
	print("  GetIndustryCount():  " + industry.GetIndustryCount());
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   123
	for (local i = -1; i < industry.GetMaxIndustryID() + 1; i++) {
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
   124
		if (industry.IsValidIndustry(i)) j++;
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
   125
		print("  Industry " + 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
   126
		print("    IsValidIndustry(): " + industry.IsValidIndustry(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
   127
		print("    GetName():         " + industry.GetName(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
   128
		print("    GetLocation():     " + industry.GetLocation(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
   129
	}
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
   130
	print("  Valid Industries:    " + j);
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
   131
	print("  GetIndustryCount():  " + industry.GetIndustryCount());
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
   132
}
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
   133
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
   134
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
   135
{
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
   136
	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
   137
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
   138
	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
   139
	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
   140
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
   141
	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
   142
	list.AddItem(1);
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
   143
	list.AddItem(2);
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
   144
	for (local i = 1000; i < 1100; 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
   145
		list.AddItem(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
   146
	}
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
   147
	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
   148
	list.RemoveItem(1150);
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
   149
	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
   150
	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
   151
	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
   152
	print("  IsEmpty():     " + list.IsEmpty());
9585
1300741e3230 (svn r9610) [NoAI] -Fix r9604: forgot to update regression
truelight
parents: 9579
diff changeset
   153
	list.SortByItem(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
   154
	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
   155
	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
   156
		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
   157
	}
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
   158
	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
   159
	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
   160
}
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
   161
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
   162
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
   163
{
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
   164
	local map = AIMap();
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
   165
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
   166
	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
   167
	print("--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
   168
	print("  GetMapSize():     " + map.GetMapSize());
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
   169
	print("  GetMapSizeX():    " + map.GetMapSizeX());
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
   170
	print("  GetMapSizeY():    " + map.GetMapSizeY());
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
   171
	print("  GetTileX(123):    " + map.GetTileX(123));
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
	print("  GetTileY(123):    " + map.GetTileY(123));
9553
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
   173
	print("  GetTileIndex():   " + map.GetTileIndex(123, 0));
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
   174
	print("  GetTileIndex():   " + map.GetTileIndex(0, 123));
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
   175
	print("  GetTileIndex():   " + map.GetTileIndex(0, 0));
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
   176
	print("  GetTileIndex():   " + map.GetTileIndex(-1, -1));
23967657558b (svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents: 9546
diff changeset
   177
	print("  GetTileIndex():   " + map.GetTileIndex(10000, 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
   178
	print("  IsValidTile(123): " + map.IsValidTile(123));
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
   179
	print("  GetTileX(124):    " + map.GetTileX(124));
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
   180
	print("  GetTileY(124):    " + map.GetTileY(124));
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
   181
	print("  IsValidTile(124): " + map.IsValidTile(124));
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
	print("  IsValidTile(0):   " + map.IsValidTile(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
   183
	print("  IsValidTile(-1):  " + map.IsValidTile(-1));
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("  IsValidTile():    " + map.IsValidTile(map.GetMapSize()));
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("  IsValidTile():    " + map.IsValidTile(map.GetMapSize() - 1));
9492
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   186
	print("  DemolishTile():   " + map.DemolishTile(19592));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   187
	print("  DemolishTile():   " + map.DemolishTile(19335));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   188
	print("  Distance");
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   189
	print("    DistanceManhattan(): " + map.DistanceManhattan(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   190
	print("    DistanceMax():       " + map.DistanceMax(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   191
	print("    DistanceSquare():    " + map.DistanceSquare(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   192
	print("    DistanceFromEdge():  " + map.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
   193
}
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
   194
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   195
function Regression::Order()
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   196
{
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   197
	local order = AIOrder();
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   198
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   199
	print("");
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   200
	print("--Order--");
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   201
	print("  GetNumberOfOrders():   " + order.GetNumberOfOrders(1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   202
	print("  GetOrderDestination(): " + order.GetOrderDestination(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   203
	print("  AreOrderFlagsValid():  " + order.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   204
	print("  IsValidVehicleOrder(): " + order.IsValidVehicleOrder(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   205
	print("  GetOrderFlags():       " + order.GetOrderFlags(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   206
	print("  AppendOrder():         " + order.AppendOrder(1024, 33416, AIOrder.AIOF_TRANSFER));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   207
	print("  InsertOrder():         " + order.InsertOrder(1024, 0, 33416, AIOrder.AIOF_TRANSFER));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   208
	print("  GetNumberOfOrders():   " + order.GetNumberOfOrders(1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   209
	print("  IsValidVehicleOrder(): " + order.IsValidVehicleOrder(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   210
	print("  RemoveOrder():         " + order.RemoveOrder(1024, 0));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   211
	print("  ChangeOrder():         " + order.ChangeOrder(1024, 0, AIOrder.AIOF_FULL_LOAD));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   212
	print("  GetOrderDestination(): " + order.GetOrderDestination(1024, 0));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   213
	print("  CopyOrders():          " + order.CopyOrders(1025, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   214
	print("  CopyOrders():          " + order.CopyOrders(1025, 1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   215
	print("  ShareOrders():         " + order.ShareOrders(1025, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   216
	print("  ShareOrders():         " + order.ShareOrders(1025, 1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   217
	print("  UnshareOrders():       " + order.UnshareOrders(1025));
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   218
	print("  AppendOrder():         " + order.AppendOrder(1024, 33420, AIOrder.AIOF_NONE));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   219
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   220
	local list = AIVehicleStationList(1024);
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   221
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   222
	print("");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   223
	print("--VehicleStationList--");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   224
	print("  Count():             " + list.Count());
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   225
	list.Valuate(AIStationListLocation());
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   226
	print("  Location ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   227
	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
   228
		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
   229
	}
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   230
	list.Valuate(AIStationListCargoWaiting(0));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   231
	print("  CargoWaiting(0) ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   232
	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
   233
		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
   234
	}
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   235
	list.Valuate(AIStationListCargoWaiting(1));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   236
	print("  CargoWaiting(1) ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   237
	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
   238
		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
   239
	}
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   240
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   241
	list = AIStationVehicleList(0);
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   242
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   243
	print("");
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   244
	print("--StationVehicleList--");
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   245
	print("  Count():             " + list.Count());
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   246
	list.Valuate(AIVehicleListLocation());
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   247
	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
   248
	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
   249
		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
   250
	}
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   251
}
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   252
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   253
function Regression::Road()
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   254
{
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   255
	local road = AIRoad();
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   256
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   257
	print("");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   258
	print("--Road--");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   259
	print("  Road");
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   260
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   261
	print("    BuildRoad():                   " + road.BuildRoad(0, 1));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   262
	print("    BuildRoad():                   " + road.BuildRoad(33411, 33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   263
	print("    BuildRoad():                   " + road.BuildRoad(33411, 33414));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   264
	print("    AreRoadTilesConnected():       " + road.AreRoadTilesConnected(33412, 33413));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   265
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
   266
	print("    GetNeighbourRoadCount():       " + road.GetNeighbourRoadCount(33412));
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   267
	print("    RemoveRoad():                  " + road.RemoveRoad(33411, 33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   268
	print("    RemoveRoad():                  " + road.RemoveRoad(33411, 33412));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   269
	print("    RemoveRoad():                  " + road.RemoveRoad(19590, 19590));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   270
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   271
	print("  Depot");
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   272
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   273
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(0, 1));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   274
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33411, 33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   275
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33411, 33414));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   276
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33411, 33412));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   277
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   278
	print("    GetRoadDepotFrontTile():       " + road.GetRoadDepotFrontTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   279
	print("    IsRoadDepotTile():             " + road.IsRoadDepotTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   280
	print("    RemoveRoadDepot():             " + road.RemoveRoadDepot(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   281
	print("    RemoveRoadDepot():             " + road.RemoveRoadDepot(33411));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   282
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   283
	print("  Station");
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   284
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   285
	print("    BuildRoadStation():            " + road.BuildRoadStation(0, 1, false, false));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   286
	print("    BuildRoadStation():            " + road.BuildRoadStation(33411, 33411, false, false));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   287
	print("    BuildRoadStation():            " + road.BuildRoadStation(33411, 33414, false, false));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   288
	print("    BuildRoadStation():            " + road.BuildRoadStation(33411, 33412, false, false));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   289
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   290
	print("    GetDriveThroughBackTile():     " + road.GetDriveThroughBackTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   291
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   292
	print("    IsRoadStationTile():           " + road.IsRoadStationTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   293
	print("    IsDriveThroughRoadStationTile: " + road.IsDriveThroughRoadStationTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   294
	print("    RemoveRoadStation():           " + road.RemoveRoadStation(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   295
	print("    RemoveRoadStation():           " + road.RemoveRoadStation(33411));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   296
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   297
	print("  Station Types");
9634
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   298
	print("    BuildRoadStation(bus):         " + road.BuildRoadStation(33411, 33410, false, false));
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   299
	print("    BuildRoadStation(truck):       " + road.BuildRoadStation(33420, 33421, true,  false));
9634
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   300
	print("    BuildRoadStation(truck):       " + road.BuildRoadStation(33412, 33413, true,  false));
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   301
	print("    BuildRoadStation(bus):         " + road.BuildRoadStation(33411 + 256, 33411, false, false));
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   302
	print("    BuildRoadStation(truck):       " + road.BuildRoadStation(33412 + 256, 33412 + 256 + 256, true,  false));
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   303
	print("    BuildRoadStation(bus-drive):   " + road.BuildRoadStation(33413, 33412, false, true));
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   304
	print("    BuildRoadStation(truck-drive): " + road.BuildRoadStation(33414, 33413, true,  true));
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   305
	print("    BuildRoadStation(bus-drive):   " + road.BuildRoadStation(33415, 33414, false, true));
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   306
	print("    BuildRoadStation(truck-drive): " + road.BuildRoadStation(33416, 33415, true,  true));
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   307
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33417, 33418));
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   308
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33411 + 256));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   309
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33412 + 256));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   310
	print("    IsDriveThroughRoadStationTile: " + road.IsDriveThroughRoadStationTile(33415));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   311
	print("    GetDriveThroughBackTile():     " + road.GetDriveThroughBackTile(33415));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   312
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33415));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   313
	print("    IsRoadTile():                  " + road.IsRoadTile(33415));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   314
}
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   315
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   316
function Regression::Sign()
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   317
{
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   318
	local sign = AISign();
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   319
	local j = 0;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   320
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   321
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   322
	print("--Sign--");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   323
	print("  BuildSign(33410, 'Some Sign'):       " + sign.BuildSign(33410, "Some Sign"));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   324
	local sign_id = sign.BuildSign(33409, "Some other Sign");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   325
	print("  BuildSign(33409, 'Some other Sign'): " + sign_id);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   326
	print("  RemoveSign(" + sign_id + "):                       " + sign.RemoveSign(sign_id));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   327
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   328
	print("  GetMaxSignID():    " + sign.GetMaxSignID());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   329
	print("  GetSignCount():    " + sign.GetSignCount());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   330
	for (local i = -1; i < sign.GetMaxSignID() + 1; i++) {
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   331
		if (sign.IsValidSign(i)) j++;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   332
		print("  Sign " + i);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   333
		print("    IsValidSign():   " + sign.IsValidSign(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   334
		print("    GetText():       " + sign.GetText(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   335
		print("    GetLocation():   " + sign.GetLocation(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   336
	}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   337
	print("  Valid Signs:       " + j);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   338
	print("  GetSignCount():    " + sign.GetSignCount());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   339
}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   340
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
   341
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
   342
{
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
   343
	local station = AIStation();
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
   344
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
   345
	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
   346
	print("--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
   347
	print("  IsValidStation(0):        " + station.IsValidStation(0));
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
   348
	print("  IsValidStation(1000):     " + station.IsValidStation(1000));
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
   349
	print("  GetLocation(0):           " + station.GetLocation(0));
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
   350
	print("  GetLocation(1000):        " + station.GetLocation(1000));
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
   351
	print("  GetCargoWaiting(0, 0):    " + station.GetCargoWaiting(0, 0));
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
   352
	print("  GetCargoWaiting(1000, 0): " + station.GetCargoWaiting(1000, 0));
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
   353
	print("  GetCargoWaiting(0, 1000): " + station.GetCargoWaiting(0, 1000));
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
   354
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
   355
	local list = AIStationList(AIStationList.STATION_BUS_STOP + AIStationList.STATION_TRUCK_STOP);
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
   356
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
   357
	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
   358
	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
   359
	print("  Count():             " + list.Count());
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
   360
	list.Valuate(AIStationListLocation());
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
   361
	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
   362
	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
   363
		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
   364
	}
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
   365
	list.Valuate(AIStationListCargoWaiting(0));
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
   366
	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
   367
	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
   368
		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
   369
	}
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
   370
	list.Valuate(AIStationListCargoWaiting(1));
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
   371
	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
   372
	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
   373
		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
   374
	}
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
   375
}
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
   376
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   377
function Regression::TileList()
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   378
{
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   379
	local list = AITileList();
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   380
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   381
	print("");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   382
	print("--TileList--");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   383
	print("  Count():             " + list.Count());
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   384
	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
   385
	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
   386
9611
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   387
	list.Valuate(AITileListSlope());
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   388
	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
   389
	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
   390
	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
   391
	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
   392
	print("  ListDump:");
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   393
	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
   394
		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
   395
	}
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   396
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   397
	list.Valuate(AITileListBuildable());
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   398
	list.KeepValue(1);
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   399
	print("  Buildable():         done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   400
	print("  KeepValue(1):        done");
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   401
	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
   402
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   403
	list.Valuate(AITileListCargoAcceptance(0));
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   404
	list.KeepAboveValue(10);
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   405
	print("  CargoAcceptance():   done");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   406
	print("  KeepAboveValue(10):  done");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   407
	print("  Count():             " + list.Count());
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   408
	print("  ListDump:");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   409
	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
   410
		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
   411
	}
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   412
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   413
	list.Valuate(AITileListRoadTile());
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   414
	list.KeepValue(1);
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   415
	print("  RoadTile():          done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   416
	print("  KeepValue(1):        done");
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   417
	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
   418
	print("  ListDump:");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   419
	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
   420
		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
   421
	}
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   422
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
   423
	list.Valuate(AITileListNeighbourRoadCount());
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   424
	list.KeepValue(1);
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
   425
	print("  NeighbourRoadCount():done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   426
	print("  KeepValue(1):        done");
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   427
	print("  Count():             " + list.Count());
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   428
	print("  ListDump:");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   429
	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
   430
		print("    " + i + " => " + list.GetValue(i));
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   431
	}
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   432
}
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   433
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
   434
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
   435
{
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
   436
	local town = AITown();
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
   437
	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
   438
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
   439
	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
   440
	print("--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
   441
	print("  GetMaxTownID():    " + town.GetMaxTownID());
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
   442
	print("  GetTownCount():    " + town.GetTownCount());
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   443
	for (local i = -1; i < town.GetMaxTownID() + 1; i++) {
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
   444
		if (town.IsValidTown(i)) j++;
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
   445
		print("  Town " + 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
   446
		print("    IsValidTown():   " + town.IsValidTown(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
   447
		print("    GetName():       " + town.GetName(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
   448
		print("    GetPopulation(): " + town.GetPopulation(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
   449
		print("    GetLocation():   " + town.GetLocation(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
   450
	}
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   451
	print("  Valid Towns:       " + 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
   452
	print("  GetTownCount():    " + town.GetTownCount());
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
   453
}
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
   454
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   455
function Regression::TownList()
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   456
{
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   457
	local list = AITownList();
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   458
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   459
	print("");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   460
	print("--TownList--");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   461
	print("  Count():             " + list.Count());
9616
ca607e3077dd (svn r9783) [NoAI] -Fix: make naming more consistent between Valuators: don't add Get before them.
truelight
parents: 9615
diff changeset
   462
	list.Valuate(AITownListPopulation());
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   463
	list.KeepAboveValue(500);
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   464
	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
   465
	print("  Count():             " + list.Count());
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   466
	print("  ListDump:");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   467
	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
   468
		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
   469
	}
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   470
}
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   471
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   472
function Regression::Vehicle()
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   473
{
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   474
	local accounting = AIAccounting();
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   475
	local company = AICompany();
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   476
	local vehicle = AIVehicle();
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   477
	local j = 0;
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   478
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   479
	print("");
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   480
	print("--Vehicle--");
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   481
	for (local i = -1; i < 257; i++) {
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   482
		if (vehicle.IsValidEngine(i)) j++;
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   483
		print("  Engine " + i);
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   484
		print("    IsValidEngine():    " + vehicle.IsValidEngine(i));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   485
	}
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   486
	print("  Valid Engines:        " + j);
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   487
	print("  IsValidVehicle(-1):   " + vehicle.IsValidVehicle(-1));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   488
	print("  IsValidVehicle(0):    " + vehicle.IsValidVehicle(0));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   489
	print("  IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   490
	print("  ISValidVehicle(9999): " + vehicle.IsValidVehicle(9999));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   491
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   492
	for (local i = -1; i < 15; i++) {
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   493
		print("  FindBestRoadVehicle Cargo " + i);
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   494
		print("    Reliability 0:      " + vehicle.FindBestRoadVehicle(i, 0));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   495
		print("    Reliability 50:     " + vehicle.FindBestRoadVehicle(i, 50));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   496
		print("    Reliability 100:    " + vehicle.FindBestRoadVehicle(i, 100));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   497
	}
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   498
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   499
	local bank = company.GetBankBalance();
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   500
9560
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   501
	{
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   502
		local transaction = AITransactionMode();
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   503
		print("  BuildVehicle():       " + vehicle.BuildVehicle(33417, 153));
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   504
		print("  IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024));
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   505
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   506
		print("  --Transaction--");
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   507
		print("    GetCosts():         " + transaction.GetCosts());
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   508
		print("    Execute():          " + transaction.Execute());
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   509
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   510
		print("  IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024));
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   511
	}
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   512
	print("  CloneVehicle():       " + vehicle.CloneVehicle(33417, 1024, true));
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   513
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   514
	local bank_after = company.GetBankBalance();
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   515
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   516
	print("  --Accounting--");
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   517
	print("    GetCosts():         " + accounting.GetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   518
	print("    Should be:          " + (bank - bank_after));
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   519
	print("    ResetCosts():       " + accounting.ResetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   520
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   521
	bank = company.GetBankBalance();
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   522
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   523
	print("  SellVehicle(1025):    " + vehicle.SellVehicle(1025));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   524
	print("  StartStopVehicle():   " + vehicle.StartStopVehicle(1024));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   525
	print("  SendVehicleToDepot(): " + vehicle.SendVehicleToDepot(1024));
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   526
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   527
	bank_after = company.GetBankBalance();
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   528
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   529
	print("  --Accounting--");
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   530
	print("    GetCosts():         " + accounting.GetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   531
	print("    Should be:          " + (bank - bank_after));
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   532
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   533
	print("  CloneVehicle():       " + vehicle.CloneVehicle(33417, 1024, true));
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   534
9615
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   535
	print("  --VehicleData--");
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   536
	print("    GetLocation():       " + vehicle.GetLocation(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   537
	print("    GetEngineType():     " + vehicle.GetEngineType(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   538
	print("    GetUnitNumber():     " + vehicle.GetUnitNumber(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   539
	print("    GetAge():            " + vehicle.GetAge(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   540
	print("    GetMaxAge():         " + vehicle.GetMaxAge(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   541
	print("    GetAgeLeft():        " + vehicle.GetAgeLeft(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   542
	print("    GetProfitThisYear(): " + vehicle.GetProfitThisYear(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   543
	print("    GetProfitLastYear(): " + vehicle.GetProfitLastYear(1024));
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   544
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   545
	local list = AIVehicleList();
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   546
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   547
	print("");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   548
	print("--VehicleList--");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   549
	print("  Count():             " + list.Count());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   550
	list.Valuate(AIVehicleListLocation());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   551
	print("  Location ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   552
	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
   553
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   554
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   555
	list.Valuate(AIVehicleListEngineType());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   556
	print("  EngineType ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   557
	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
   558
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   559
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   560
	list.Valuate(AIVehicleListUnitNumber());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   561
	print("  UnitNumber ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   562
	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
   563
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   564
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   565
	list.Valuate(AIVehicleListAge());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   566
	print("  Age ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   567
	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
   568
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   569
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   570
	list.Valuate(AIVehicleListMaxAge());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   571
	print("  MaxAge ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   572
	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
   573
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   574
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   575
	list.Valuate(AIVehicleListAgeLeft());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   576
	print("  AgeLeft ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   577
	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
   578
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   579
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   580
	list.Valuate(AIVehicleListProfitThisYear());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   581
	print("  ProfitThisYear ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   582
	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
   583
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   584
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   585
	list.Valuate(AIVehicleListProfitLastYear());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   586
	print("  ProfitLastYear ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   587
	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
   588
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   589
	}
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   590
}
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   591
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
   592
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
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
   594
{
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
   595
	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
   596
	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
   597
	this.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
   598
	this.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
   599
	this.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
   600
	this.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
   601
	this.Map();
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
   602
	this.List();
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   603
	this.Road();
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   604
	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
   605
	this.Station();
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   606
	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
   607
	this.Town();
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   608
	this.TownList();
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   609
	this.Vehicle();
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   610
	/* Order has to be after Vehicle */
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   611
	this.Order();
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
   612
}
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
   613
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
   614
function Regression::Stop()
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
   615
{
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
   616
	this.stop = true;
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
   617
}
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
   618
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
   619
class FRegression extends AIFactory {
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
   620
	function GetAuthor()      { return "OpenTTD Dev Team"; }
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
   621
	function GetName()        { return "Regression"; }
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
   622
	function GetDescription() { return "This runs regression-tests on all commands. On the same map the result should always be the same."; }
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
   623
	function GetVersion()     { return 1; }
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
   624
	function GetDate()        { return "2007-03-18"; }
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
   625
	function CreateInstance() { return "Regression"; }
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
   626
}
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
   627
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
   628
/* Only enable this if you want to run the regression test.
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
   629
 *  The best way to do it is to disable all other AIs, so you are sure thisone
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
   630
 *  kicks in, and use a pre-made savegame of which you already know the result.
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
   631
 * You can compare the output from this AI with the pre-made one, and it should
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
   632
 *  match. If not, something went wrong. */
9470
4593c953a276 (svn r9308) [NoAI] -Change: make the regression scripts run without any user intervention; not manual enabling and disabling of AIs
rubidium
parents: 9461
diff changeset
   633
iFRegression <-FRegression();