bin/ai/regression/regression.nut
author truelight
Wed, 18 Jul 2007 10:53:58 +0000
branchnoai
changeset 9672 18c71ca987e4
parent 9670 820b77e19bb3
child 9682 d031eb183733
permissions -rw-r--r--
(svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
[NoAI] -Change [API]: FindBestXXX now takes max_cost as 3rd param, to find a vehicle below a given treshhold
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
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    58
function Regression::Airport()
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    59
{
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    60
	local airport = AIAirport();
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    61
	local company = AICompany();
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    62
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    63
	print("");
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    64
	print("--AIAirport--");
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    65
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    66
	print("  IsHangarTile():       " + airport.IsHangarTile(32116));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    67
	print("  IsAirportTile():      " + airport.IsAirportTile(32116));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    68
	print("  GetHangarOfAirport(): " + airport.GetHangarOfAirport(32116));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    69
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    70
	for (local i = -1; i < 10; i++) {
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
    71
		print("  AiportAvailable(" + i + "):          " + airport.AiportAvailable(i));
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
    72
		print("  GetAirportWidth(" + i + "):          " + airport.GetAirportWidth(i));
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
    73
		print("  GetAirportHeight(" + i + "):         " + airport.GetAirportHeight(i));
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
    74
		print("  GetAirportCoverageRadius(" + i + "): " + airport.GetAirportCoverageRadius(i));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    75
	}
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    76
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
    77
	print("  GetBankBalance():     " + company.GetBankBalance(AICompany.MY_COMPANY));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    78
	print("  BuildAirport():       " + airport.BuildAirport(32116, 0));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    79
	print("  IsHangarTile():       " + airport.IsHangarTile(32116));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    80
	print("  IsAirportTile():      " + airport.IsAirportTile(32116));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    81
	print("  GetHangarOfAirport(): " + airport.GetHangarOfAirport(32116));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    82
	print("  IsHangarTile():       " + airport.IsHangarTile(32119));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    83
	print("  IsAirportTile():      " + airport.IsAirportTile(32119));
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
    84
	print("  GetBankBalance():     " + company.GetBankBalance(AICompany.MY_COMPANY));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    85
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    86
	print("  RemoveAirport():      " + airport.RemoveAirport(32118));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    87
	print("  IsHangarTile():       " + airport.IsHangarTile(32119));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    88
	print("  IsAirportTile():      " + airport.IsAirportTile(32119));
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
    89
	print("  GetBankBalance():     " + company.GetBankBalance(AICompany.MY_COMPANY));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    90
	print("  BuildAirport():       " + airport.BuildAirport(32116, 0));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    91
}
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
    92
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
    93
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
    94
{
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
	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
    96
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
    97
	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
    98
	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
    99
	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
   100
		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
   101
		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
   102
		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
   103
		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
   104
		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
   105
		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
   106
		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
   107
		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
   108
	}
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
}
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
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
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
   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
	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
   114
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
	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
   116
	print("--Company--");
9558
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   117
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   118
	/* Test AIXXXMode() in scopes */
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   119
	{
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   120
		local test = AITestMode();
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   121
		print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   122
		print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   123
		{
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   124
			local exec = AIExecMode();
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   125
			print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   126
			print("  SetCompanyName():     " + company.SetCompanyName("Regression"));
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   127
		}
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   128
	}
4fc9b464a932 (svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents: 9557
diff changeset
   129
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   130
	print("  GetCompanyName():            " + company.GetCompanyName(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   131
	print("  GetPresidentName():          " + company.GetPresidentName(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   132
	print("  SetPresidentName():          " + company.SetPresidentName("Regression AI"));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   133
	print("  GetPresidentName():          " + company.GetPresidentName(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   134
	print("  GetCompanyValue():           " + company.GetCompanyValue(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   135
	print("  GetBankBalance():            " + company.GetBankBalance(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   136
	print("  GetLoanAmount():             " + company.GetLoanAmount());
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   137
	print("  GetMaxLoanAmount():          " + company.GetMaxLoanAmount());
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   138
	print("  GetLoanInterval():           " + company.GetLoanInterval());
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   139
	print("  SetLoanAmount(1):            " + company.SetLoanAmount(1));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   140
	print("  SetLoanAmount(100):          " + company.SetLoanAmount(100));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   141
	print("  SetLoanAmount(10000):        " + company.SetLoanAmount(10000));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   142
	print("  GetBankBalance():            " + company.GetBankBalance(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   143
	print("  GetLoanAmount():             " + company.GetLoanAmount());
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   144
	print("  SetMinimumLoanAmount(31337): " + company.SetMinimumLoanAmount(31337));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   145
	print("  GetBankBalance():            " + company.GetBankBalance(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   146
	print("  GetLoanAmount():             " + company.GetLoanAmount());
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   147
	print("  SetLoanAmount(10000):        " + company.SetLoanAmount(company.GetMaxLoanAmount()));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   148
	print("  GetBankBalance():            " + company.GetBankBalance(AICompany.MY_COMPANY));
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   149
	print("  GetLoanAmount():             " + company.GetLoanAmount());
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
   150
}
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
   151
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
   152
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
   153
{
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
   154
	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
   155
	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
   156
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
   157
	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
   158
	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
   159
	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
   160
	print("  GetIndustryCount():  " + industry.GetIndustryCount());
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   161
	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
   162
		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
   163
		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
   164
		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
   165
		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
   166
		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
   167
	}
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("  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
   169
	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
   170
}
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
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   172
function Regression::IndustryList()
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   173
{
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   174
	local list = AIIndustryList();
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   175
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   176
	print("");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   177
	print("--IndustryList--");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   178
	print("  Count():             " + list.Count());
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   179
	list.Valuate(AIIndustryListLocation());
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   180
	print("  Location ListDump:");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   181
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   182
		print("    " + i + " => " + list.GetValue(i));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   183
	}
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   184
	list.Valuate(AIIndustryListDistanceManhattanToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   185
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   186
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   187
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   188
	}
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   189
	list.Valuate(AIIndustryListDistanceSquareToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   190
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   191
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   192
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   193
	}
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   194
	list.Valuate(AIIndustryListProduction(1));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   195
	list.KeepAboveValue(50);
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   196
	print("  KeepAboveValue(50): done");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   197
	print("  Count():             " + list.Count());
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   198
	print("  Production ListDump:");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   199
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   200
		print("    " + i + " => " + list.GetValue(i));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   201
	}
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   202
}
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   203
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
   204
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
   205
{
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
   206
	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
   207
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
   208
	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
   209
	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
   210
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
   211
	print("  IsEmpty():     " + list.IsEmpty());
9664
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   212
	list.AddItem(1, 1);
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   213
	list.AddItem(2, 2);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   214
	for (local i = 1000; i < 1100; i++) {
9664
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   215
		list.AddItem(i, i);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   216
	}
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
   217
	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
   218
	list.RemoveItem(1150);
9664
c5741021bf59 (svn r10577) [NoAI] -Add: added ChangeItem to AIList
truelight
parents: 9660
diff changeset
   219
	list.ChangeItem(1051, 12);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   220
	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
   221
	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
   222
	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
   223
	print("  IsEmpty():     " + list.IsEmpty());
9665
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   224
	list.Sort(AIAbstractList.SORT_BY_ITEM, true);
9579
632263c0cf5a (svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents: 9575
diff changeset
   225
	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
   226
	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
   227
		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
   228
	}
9660
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   229
	list.Valuate(AIListRandomize());
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   230
	print("  Randomize ListDump:");
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   231
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   232
		print("    " + i + " => " + list.GetValue(i));
d0a430e8310b (svn r10569) [NoAI] -Add: added AIListRandomize as Valuator for all lists to attach a random value to all items
truelight
parents: 9658
diff changeset
   233
	}
9665
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   234
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   235
	list.KeepTop(10);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   236
	print("  KeepTop(10):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   237
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   238
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   239
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   240
	list.KeepBottom(8);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   241
	print("  KeepBottom(8):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   242
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   243
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   244
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   245
	list.RemoveBottom(2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   246
	print("  RemoveBottom(2):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   247
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   248
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   249
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   250
	list.RemoveTop(2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   251
	print("  RemoveTop(2):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   252
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   253
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   254
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   255
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   256
	local list2 = AIList();
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   257
	list2.AddItem(1003, 0);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   258
	list2.AddItem(1004, 0);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   259
	list.RemoveList(list2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   260
	print("  RemoveList({1003, 1004}):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   261
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   262
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   263
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   264
	list2.AddItem(1005, 0);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   265
	list.KeepList(list2);
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   266
	print("  KeepList({1003, 1004, 1005}):");
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   267
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   268
		print("    " + i + " => " + list.GetValue(i));
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   269
	}
e889ac1e663a (svn r10579) [NoAI] -Add: functions to remove/keep the top/bottom X items from a list.
rubidium
parents: 9664
diff changeset
   270
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
   271
	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
   272
	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
   273
}
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
   274
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
   275
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
   276
{
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
   277
	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
   278
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
   279
	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
   280
	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
   281
	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
   282
	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
   283
	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
   284
	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
   285
	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
   286
	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
   287
	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
   288
	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
   289
	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
   290
	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
   291
	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
   292
	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
   293
	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
   294
	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
   295
	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
   296
	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
   297
	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
   298
	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
   299
	print("  DemolishTile():   " + map.DemolishTile(19592));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   300
	print("  DemolishTile():   " + map.DemolishTile(19335));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   301
	print("  Distance");
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   302
	print("    DistanceManhattan(): " + map.DistanceManhattan(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   303
	print("    DistanceMax():       " + map.DistanceMax(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   304
	print("    DistanceSquare():    " + map.DistanceSquare(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   305
	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
   306
}
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
   307
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   308
function Regression::Order()
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   309
{
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   310
	local order = AIOrder();
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   311
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   312
	print("");
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   313
	print("--Order--");
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   314
	print("  GetNumberOfOrders():   " + order.GetNumberOfOrders(1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   315
	print("  GetOrderDestination(): " + order.GetOrderDestination(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   316
	print("  AreOrderFlagsValid():  " + order.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   317
	print("  IsValidVehicleOrder(): " + order.IsValidVehicleOrder(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   318
	print("  GetOrderFlags():       " + order.GetOrderFlags(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   319
	print("  AppendOrder():         " + order.AppendOrder(1024, 33416, AIOrder.AIOF_TRANSFER));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   320
	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
   321
	print("  GetNumberOfOrders():   " + order.GetNumberOfOrders(1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   322
	print("  IsValidVehicleOrder(): " + order.IsValidVehicleOrder(1024, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   323
	print("  RemoveOrder():         " + order.RemoveOrder(1024, 0));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   324
	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
   325
	print("  GetOrderDestination(): " + order.GetOrderDestination(1024, 0));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   326
	print("  CopyOrders():          " + order.CopyOrders(1025, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   327
	print("  CopyOrders():          " + order.CopyOrders(1025, 1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   328
	print("  ShareOrders():         " + order.ShareOrders(1025, 1));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   329
	print("  ShareOrders():         " + order.ShareOrders(1025, 1024));
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   330
	print("  UnshareOrders():       " + order.UnshareOrders(1025));
9652
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   331
	print("  AppendOrder():         " + order.AppendOrder(1024, 33421, AIOrder.AIOF_NONE));
9645
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   332
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   333
	local list = AIVehicleStationList(1024);
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   334
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   335
	print("");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   336
	print("--VehicleStationList--");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   337
	print("  Count():             " + list.Count());
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   338
	list.Valuate(AIStationListLocation());
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   339
	print("  Location ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   340
	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
   341
		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
   342
	}
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   343
	list.Valuate(AIStationListCargoWaiting(0));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   344
	print("  CargoWaiting(0) ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   345
	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
   346
		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
   347
	}
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   348
	list.Valuate(AIStationListCargoWaiting(1));
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   349
	print("  CargoWaiting(1) ListDump:");
25126afa0c25 (svn r10538) [NoAI] -Add: added AIVehicleStationList, which lists all stations a vehicle goes to
truelight
parents: 9638
diff changeset
   350
	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
   351
		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
   352
	}
9648
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   353
	list.Valuate(AIStationListCargoRating(1));
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   354
	print("  CargoRating(1) ListDump:");
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   355
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   356
		print("    " + i + " => " + list.GetValue(i));
760b7b504e37 (svn r10543) [NoAI] -Add: added AIStationListCargoRating as valuator for a station list
truelight
parents: 9647
diff changeset
   357
	}
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   358
	list.Valuate(AIStationListDistanceManhattanToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   359
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   360
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   361
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   362
	}
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   363
	list.Valuate(AIStationListDistanceSquareToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   364
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   365
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   366
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   367
	}
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   368
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   369
	list = AIStationVehicleList(1);
9647
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   370
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   371
	print("");
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   372
	print("--StationVehicleList--");
c17046b1b8a2 (svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents: 9645
diff changeset
   373
	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
   374
	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
   375
	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
   376
	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
   377
		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
   378
	}
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   379
}
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   380
9652
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   381
function Regression::PathFinder()
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   382
{
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   383
	local pf = AIPathFinderStupid(AIPathFinder.PATHFINDER_ROAD);
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   384
	local start = AITileList();
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   385
	local end = AITileList();
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   386
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   387
	start.AddTile(33421);
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   388
	end.AddTile(33480 + 256 * 10);
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   389
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   390
	print("");
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   391
	print("--PathFinderStupid--");
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   392
	local ret = pf.FindRoute(start, end);
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   393
	print("  FindRoute():  " + (ret ? "Route Array" : "Nil"));
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   394
	print("  BuildRoute(): " + pf.BuildRoute(ret));
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   395
	pf.FreeRoute(ret);
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   396
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   397
	local road = AIRoad();
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   398
	print("  IsRoadTile(): " + road.IsRoadTile(33425));
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   399
	print("  IsRoadTile(): " + road.IsRoadTile(33480 + 256 * 5));
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   400
}
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   401
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   402
function Regression::Road()
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   403
{
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   404
	local road = AIRoad();
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   405
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   406
	print("");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   407
	print("--Road--");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   408
	print("  Road");
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   409
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   410
	print("    BuildRoad():                   " + road.BuildRoad(0, 1));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   411
	print("    BuildRoad():                   " + road.BuildRoad(33411, 33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   412
	print("    BuildRoad():                   " + road.BuildRoad(33411, 33414));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   413
	print("    AreRoadTilesConnected():       " + road.AreRoadTilesConnected(33412, 33413));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   414
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
   415
	print("    GetNeighbourRoadCount():       " + road.GetNeighbourRoadCount(33412));
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   416
	print("    RemoveRoad():                  " + road.RemoveRoad(33411, 33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   417
	print("    RemoveRoad():                  " + road.RemoveRoad(33411, 33412));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   418
	print("    RemoveRoad():                  " + road.RemoveRoad(19590, 19590));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   419
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   420
	print("  Depot");
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   421
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   422
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(0, 1));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   423
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33411, 33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   424
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33411, 33414));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   425
	print("    BuildRoadDepot():              " + road.BuildRoadDepot(33411, 33412));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   426
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   427
	print("    GetRoadDepotFrontTile():       " + road.GetRoadDepotFrontTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   428
	print("    IsRoadDepotTile():             " + road.IsRoadDepotTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   429
	print("    RemoveRoadDepot():             " + road.RemoveRoadDepot(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   430
	print("    RemoveRoadDepot():             " + road.RemoveRoadDepot(33411));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   431
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   432
	print("  Station");
9555
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   433
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   434
	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
   435
	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
   436
	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
   437
	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
   438
	print("    IsRoadTile():                  " + road.IsRoadTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   439
	print("    GetDriveThroughBackTile():     " + road.GetDriveThroughBackTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   440
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   441
	print("    IsRoadStationTile():           " + road.IsRoadStationTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   442
	print("    IsDriveThroughRoadStationTile: " + road.IsDriveThroughRoadStationTile(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   443
	print("    RemoveRoadStation():           " + road.RemoveRoadStation(33411));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   444
	print("    RemoveRoadStation():           " + road.RemoveRoadStation(33411));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   445
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   446
	print("  Station Types");
9634
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   447
	print("    BuildRoadStation(bus):         " + road.BuildRoadStation(33411, 33410, false, false));
9652
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   448
	print("    BuildRoadStation(truck):       " + road.BuildRoadStation(33421, 33422, true,  false));
9634
e359d82f0652 (svn r10525) [NoAI] -Fix: the build-truck-param of BuildRoadStation was flipped
truelight
parents: 9617
diff changeset
   449
	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
   450
	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
   451
	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
   452
	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
   453
	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
   454
	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
   455
	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
   456
	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
   457
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33411 + 256));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   458
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33412 + 256));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   459
	print("    IsDriveThroughRoadStationTile: " + road.IsDriveThroughRoadStationTile(33415));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   460
	print("    GetDriveThroughBackTile():     " + road.GetDriveThroughBackTile(33415));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   461
	print("    GetRoadStationFrontTile():     " + road.GetRoadStationFrontTile(33415));
00ccc64d342c (svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents: 9553
diff changeset
   462
	print("    IsRoadTile():                  " + road.IsRoadTile(33415));
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   463
}
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   464
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   465
function Regression::Sign()
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   466
{
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   467
	local sign = AISign();
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   468
	local j = 0;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   469
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   470
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   471
	print("--Sign--");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   472
	print("  BuildSign(33410, 'Some Sign'):       " + sign.BuildSign(33410, "Some Sign"));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   473
	local sign_id = sign.BuildSign(33409, "Some other Sign");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   474
	print("  BuildSign(33409, 'Some other Sign'): " + sign_id);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   475
	print("  RemoveSign(" + sign_id + "):                       " + sign.RemoveSign(sign_id));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   476
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   477
	print("  GetMaxSignID():    " + sign.GetMaxSignID());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   478
	print("  GetSignCount():    " + sign.GetSignCount());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   479
	for (local i = -1; i < sign.GetMaxSignID() + 1; i++) {
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   480
		if (sign.IsValidSign(i)) j++;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   481
		print("  Sign " + i);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   482
		print("    IsValidSign():   " + sign.IsValidSign(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   483
		print("    GetText():       " + sign.GetText(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   484
		print("    GetLocation():   " + sign.GetLocation(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   485
	}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   486
	print("  Valid Signs:       " + j);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   487
	print("  GetSignCount():    " + sign.GetSignCount());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   488
}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   489
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
   490
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
   491
{
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
   492
	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
   493
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
   494
	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
   495
	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
   496
	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
   497
	print("  IsValidStation(1000):     " + station.IsValidStation(1000));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   498
	print("  GetLocation(1):           " + station.GetLocation(1));
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
   499
	print("  GetLocation(1000):        " + station.GetLocation(1000));
9666
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9665
diff changeset
   500
	print("  GetStationID(33411):      " + station.GetStationID(33411));
5765eb70736d (svn r10580) [NoAI] -Add: added GetStationID to get the StationID based on a tile
truelight
parents: 9665
diff changeset
   501
	print("  GetStationID(34411):      " + station.GetStationID(34411));
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
   502
	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
   503
	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
   504
	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
   505
9670
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
   506
	print("  GetCoverageRadius(bus):   " + station.GetCoverageRadius(AIStation.STATION_BUS_STOP));
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
   507
	print("  GetCoverageRadius(truck): " + station.GetCoverageRadius(AIStation.STATION_TRUCK_STOP));
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
   508
	print("  GetCoverageRadius(train): " + station.GetCoverageRadius(AIStation.STATION_TRAIN));
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
   509
820b77e19bb3 (svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
truelight
parents: 9668
diff changeset
   510
	local list = AIStationList(AIStation.STATION_BUS_STOP + AIStation.STATION_TRUCK_STOP);
9638
f6d169a5a45a (svn r10529) [NoAI] -Add: added AIStation to gather information about stations directly by Id, which is used now by AIStationList
truelight
parents: 9636
diff changeset
   511
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
   512
	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
   513
	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
   514
	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
   515
	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
   516
	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
   517
	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
   518
		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
   519
	}
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
   520
	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
   521
	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
   522
	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
   523
		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
   524
	}
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
   525
	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
   526
	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
   527
	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
   528
		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
   529
	}
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
   530
}
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
   531
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   532
function Regression::TileList()
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   533
{
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   534
	local list = AITileList();
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   535
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   536
	print("");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   537
	print("--TileList--");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   538
	print("  Count():             " + list.Count());
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   539
	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
   540
	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
   541
9611
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   542
	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
   543
	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
   544
	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
   545
	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
   546
	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
   547
	print("  ListDump:");
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   548
	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
   549
		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
   550
	}
5cf58c6571b7 (svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents: 9609
diff changeset
   551
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   552
	list.Valuate(AITileListBuildable());
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   553
	list.KeepValue(1);
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   554
	print("  Buildable():         done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   555
	print("  KeepValue(1):        done");
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   556
	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
   557
9657
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
   558
	list.Valuate(AITileListBuildableRectangle(3, 3));
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
   559
	print("  BuildableRectangle(3, 3) ListDump:");
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
   560
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
   561
		print("    " + i + " => " + list.GetValue(i));
f2c6e332d8bc (svn r10564) [NoAI] -Add: added a AITileList valuator that checks for a NxM buildable spot with the entry from the AITileList as top-left tile
truelight
parents: 9655
diff changeset
   562
	}
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   563
	list.Valuate(AITileListDistanceManhattanToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   564
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   565
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   566
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   567
	}
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   568
	list.Valuate(AITileListDistanceSquareToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   569
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   570
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   571
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   572
	}
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   573
9658
e7675771bca4 (svn r10565) [NoAI] -Add: allow giving width, height and radius to check for cargo acceptance
truelight
parents: 9657
diff changeset
   574
	list.Valuate(AITileListCargoAcceptance(0, 1, 1, 3));
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   575
	list.KeepAboveValue(10);
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   576
	print("  CargoAcceptance():   done");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   577
	print("  KeepAboveValue(10):  done");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   578
	print("  Count():             " + list.Count());
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   579
	print("  ListDump:");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   580
	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
   581
		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
   582
	}
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   583
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   584
	list.Valuate(AITileListRoadTile());
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   585
	list.KeepValue(1);
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   586
	print("  RoadTile():          done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   587
	print("  KeepValue(1):        done");
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   588
	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
   589
	print("  ListDump:");
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   590
	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
   591
		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
   592
	}
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   593
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
   594
	list.Valuate(AITileListNeighbourRoadCount());
9605
2c2348827b52 (svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents: 9592
diff changeset
   595
	list.KeepValue(1);
9617
df9cedf12aab (svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents: 9616
diff changeset
   596
	print("  NeighbourRoadCount():done");
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9605
diff changeset
   597
	print("  KeepValue(1):        done");
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   598
	print("  Count():             " + list.Count());
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   599
	print("  ListDump:");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   600
	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
   601
		print("    " + i + " => " + list.GetValue(i));
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   602
	}
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   603
}
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   604
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
   605
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
   606
{
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
	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
   608
	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
   609
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
   610
	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
   611
	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
   612
	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
   613
	print("  GetTownCount():    " + town.GetTownCount());
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   614
	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
   615
		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
   616
		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
   617
		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
   618
		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
   619
		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
   620
		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
   621
	}
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   622
	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
   623
	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
   624
}
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
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   626
function Regression::TownList()
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   627
{
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   628
	local list = AITownList();
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   629
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   630
	print("");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   631
	print("--TownList--");
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   632
	print("  Count():             " + list.Count());
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   633
	list.Valuate(AITownListLocation());
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   634
	print("  Location ListDump:");
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   635
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   636
		print("    " + i + " => " + list.GetValue(i));
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   637
	}
9655
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   638
	list.Valuate(AITownListDistanceManhattanToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   639
	print("  DistanceManhattanToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   640
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   641
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   642
	}
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   643
	list.Valuate(AITownListDistanceSquareToTile(30000));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   644
	print("  DistanceSquareToTile(30000) ListDump:");
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   645
	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   646
		print("    " + i + " => " + list.GetValue(i));
e8e43f333832 (svn r10557) [NoAI] -Add: added for all lists 2 valuators: DistanceManhattanToTile and DistanceSquareToTile, to get the distance from object to some tile you specify
truelight
parents: 9654
diff changeset
   647
	}
9616
ca607e3077dd (svn r9783) [NoAI] -Fix: make naming more consistent between Valuators: don't add Get before them.
truelight
parents: 9615
diff changeset
   648
	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
   649
	list.KeepAboveValue(500);
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   650
	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
   651
	print("  Count():             " + list.Count());
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   652
	print("  Population ListDump:");
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   653
	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
   654
		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
   655
	}
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   656
}
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   657
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   658
function Regression::Vehicle()
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   659
{
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   660
	local accounting = AIAccounting();
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   661
	local company = AICompany();
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   662
	local vehicle = AIVehicle();
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   663
	local j = 0;
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   664
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   665
	print("");
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   666
	print("--Vehicle--");
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   667
	for (local i = -1; i < 257; i++) {
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   668
		if (vehicle.IsValidEngine(i)) j++;
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   669
		print("  Engine " + i);
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   670
		print("    IsValidEngine():    " + vehicle.IsValidEngine(i));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   671
	}
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   672
	print("  Valid Engines:        " + j);
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   673
	print("  IsValidVehicle(-1):   " + vehicle.IsValidVehicle(-1));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   674
	print("  IsValidVehicle(0):    " + vehicle.IsValidVehicle(0));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   675
	print("  IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   676
	print("  ISValidVehicle(9999): " + vehicle.IsValidVehicle(9999));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   677
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   678
	for (local i = -1; i < 15; i++) {
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   679
		print("  FindBestRoadVehicle Cargo " + i);
9672
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   680
		print("    Cost 0:             " + vehicle.FindBestRoadVehicle(i, 0,   0));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   681
		print("    Cost 10000:         " + vehicle.FindBestRoadVehicle(i, 0,   10000));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   682
		print("    Cost 50000:         " + vehicle.FindBestRoadVehicle(i, 0,   50000));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   683
		print("    Reliability 0:      " + vehicle.FindBestRoadVehicle(i, 0,   1000000));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   684
		print("    Reliability 50:     " + vehicle.FindBestRoadVehicle(i, 50,  1000000));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   685
		print("    Reliability 100:    " + vehicle.FindBestRoadVehicle(i, 100, 1000000));
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   686
	}
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   687
	for (local i = -1; i < 15; i++) {
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   688
		print("  FindBestAircraftVehicle Cargo " + i);
9672
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   689
		print("    Reliability 0:      " + vehicle.FindBestAircraftVehicle(i, 0,   1000000));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   690
		print("    Reliability 50:     " + vehicle.FindBestAircraftVehicle(i, 50,  1000000));
18c71ca987e4 (svn r10611) [NoAI] -Fix: improved FindBestXXX, it now finds the fastest, biggest vehicle available
truelight
parents: 9670
diff changeset
   691
		print("    Reliability 100:    " + vehicle.FindBestAircraftVehicle(i, 100, 1000000));
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   692
	}
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   693
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   694
	local bank = company.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   695
9560
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   696
	{
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   697
		local transaction = AITransactionMode();
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   698
		print("  BuildVehicle():       " + vehicle.BuildVehicle(33417, 153));
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   699
		print("  IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024));
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   700
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   701
		print("  --Transaction--");
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   702
		print("    GetCosts():         " + transaction.GetCosts());
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   703
		print("    Execute():          " + transaction.Execute());
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   704
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   705
		print("  IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024));
ff2dde050a4c (svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents: 9558
diff changeset
   706
	}
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   707
	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
   708
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   709
	local bank_after = company.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   710
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   711
	print("  --Accounting--");
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   712
	print("    GetCosts():         " + accounting.GetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   713
	print("    Should be:          " + (bank - bank_after));
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   714
	print("    ResetCosts():       " + accounting.ResetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   715
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   716
	bank = company.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   717
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   718
	print("  SellVehicle(1025):    " + vehicle.SellVehicle(1025));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   719
	print("  StartStopVehicle():   " + vehicle.StartStopVehicle(1024));
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   720
	print("  SendVehicleToDepot(): " + vehicle.SendVehicleToDepot(1024));
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   721
9668
6fe3d2cb9655 (svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
rubidium
parents: 9666
diff changeset
   722
	bank_after = company.GetBankBalance(AICompany.MY_COMPANY);
9557
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   723
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   724
	print("  --Accounting--");
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   725
	print("    GetCosts():         " + accounting.GetCosts());
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   726
	print("    Should be:          " + (bank - bank_after));
a3e1a25cf3d3 (svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents: 9555
diff changeset
   727
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   728
	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
   729
9615
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   730
	print("  --VehicleData--");
f809cdc8e360 (svn r9782) [NoAI] -Add: add information functions to AIVehicle, like the valuators of AIVehicleList
truelight
parents: 9614
diff changeset
   731
	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
   732
	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
   733
	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
   734
	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
   735
	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
   736
	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
   737
	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
   738
	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
   739
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   740
	print("  BuildVehicle():       " + vehicle.BuildVehicle(32119, 219));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   741
	print("  IsValidVehicle(1026): " + vehicle.IsValidVehicle(1026));
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   742
9614
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   743
	local list = AIVehicleList();
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   744
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   745
	print("");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   746
	print("--VehicleList--");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   747
	print("  Count():             " + list.Count());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   748
	list.Valuate(AIVehicleListLocation());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   749
	print("  Location ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   750
	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
   751
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   752
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   753
	list.Valuate(AIVehicleListEngineType());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   754
	print("  EngineType ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   755
	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
   756
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   757
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   758
	list.Valuate(AIVehicleListUnitNumber());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   759
	print("  UnitNumber ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   760
	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
   761
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   762
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   763
	list.Valuate(AIVehicleListAge());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   764
	print("  Age ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   765
	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
   766
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   767
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   768
	list.Valuate(AIVehicleListMaxAge());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   769
	print("  MaxAge ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   770
	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
   771
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   772
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   773
	list.Valuate(AIVehicleListAgeLeft());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   774
	print("  AgeLeft ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   775
	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
   776
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   777
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   778
	list.Valuate(AIVehicleListProfitThisYear());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   779
	print("  ProfitThisYear ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   780
	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
   781
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   782
	}
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   783
	list.Valuate(AIVehicleListProfitLastYear());
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   784
	print("  ProfitLastYear ListDump:");
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   785
	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
   786
		print("    " + i + " => " + list.GetValue(i));
814c3bbf8ecc (svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents: 9611
diff changeset
   787
	}
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   788
}
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   789
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
   790
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
   791
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
   792
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   793
	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
   794
	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
   795
	this.Base();
9654
b836eb5c521f (svn r10556) [NoAI] -Add: added AIAirport, which can build an airport
truelight
parents: 9652
diff changeset
   796
	this.Airport();
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
   797
	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
   798
	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
   799
	this.Industry();
9649
bc8c06513f5b (svn r10544) [NoAI] -Add: added AIIndustryList to list industries
truelight
parents: 9648
diff changeset
   800
	this.IndustryList();
9460
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   801
	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
   802
	this.List();
9652
c15bf5355b95 (svn r10553) [NoAI] -Add: added a framework for AIPathFinder() and implemented a really stupid AIPathFinderStupid()
truelight
parents: 9649
diff changeset
   803
	this.PathFinder();
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   804
	this.Road();
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   805
	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
   806
	this.Station();
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents: 9589
diff changeset
   807
	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
   808
	this.Town();
9589
2fbda08db406 (svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents: 9585
diff changeset
   809
	this.TownList();
9518
b32191854ad9 (svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents: 9511
diff changeset
   810
	this.Vehicle();
9546
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   811
	/* Order has to be after Vehicle */
fde20f518285 (svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents: 9541
diff changeset
   812
	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
   813
}
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
   814
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
   815
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
   816
{
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
   817
	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
   818
}
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
   819
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
   820
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
   821
	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
   822
	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
   823
	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
   824
	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
   825
	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
   826
	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
   827
}
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
   828
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
   829
/* 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
   830
 *  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
   831
 *  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
   832
 * 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
   833
 *  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
   834
iFRegression <-FRegression();