bin/ai/regression/regression.nut
author rubidium
Thu, 22 Mar 2007 09:52:12 +0000
branchnoai
changeset 9511 f767ad06e86b
parent 9492 1aeee24046d8
child 9518 b32191854ad9
permissions -rw-r--r--
(svn r9407) [NoAI] -Add: placing of signs.
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
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    14
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    15
	print("--TestInit--");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    16
	print(" TickTest: " + this.GetTick());
b10064d51d98 (svn 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
	Sleep(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
    18
	print(" TickTest: " + this.GetTick());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    19
}
b10064d51d98 (svn 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
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
    21
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
    22
{
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
    23
	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
    24
	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
    25
	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
    26
	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
    27
}
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
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
    29
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
    30
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    31
	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
    32
b10064d51d98 (svn 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
	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
    34
	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
    35
	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
    36
	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
    37
	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
    38
	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
    39
	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
    40
	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
    41
	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
    42
	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
    43
	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
    44
	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
    45
	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
    46
	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
    47
	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
    48
	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
    49
	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
    50
	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
    51
	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
    52
	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
    53
}
b10064d51d98 (svn 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
b10064d51d98 (svn 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
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
    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
	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
    58
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    59
	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
    60
	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
    61
	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
    62
		print("  Cargo " + 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
    63
		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
    64
		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
    65
		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
    66
		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
    67
		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
    68
		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
    69
	}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    70
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    71
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    72
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
    73
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    74
	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
    75
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    76
	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
    77
	print("--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
    78
	print("  SetCompanyName():     " + company.SetCompanyName("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
    79
	print("  SetCompanyName():     " + company.SetCompanyName("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
    80
	print("  GetCompanyName():     " + company.GetCompanyName());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    81
	print("  GetCompanyValue():    " + company.GetCompanyValue());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    82
	print("  GetBankBalance():     " + company.GetBankBalance());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    83
	print("  GetLoanAmount():      " + company.GetLoanAmount());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    84
	print("  GetMaxLoanAmount():   " + company.GetMaxLoanAmount());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    85
	print("  GetLoanInterval():    " + company.GetLoanInterval());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    86
	print("  SetLoanAmount(1):     " + company.SetLoanAmount(1));
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    87
	print("  SetLoanAmount(100):   " + company.SetLoanAmount(100));
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    88
	print("  SetLoanAmount(10000): " + company.SetLoanAmount(10000));
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    89
	print("  GetBankBalance():     " + company.GetBankBalance());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    90
	print("  GetLoanAmount():      " + company.GetLoanAmount());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    91
	print("  SetLoanAmount(10000): " + company.SetLoanAmount(company.GetMaxLoanAmount()));
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    92
	print("  GetBankBalance():     " + company.GetBankBalance());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    93
	print("  GetLoanAmount():      " + company.GetLoanAmount());
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
    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
b10064d51d98 (svn 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
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
    97
{
b10064d51d98 (svn 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
	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
    99
	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
   100
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   101
	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
   102
	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
   103
	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
   104
	print("  GetIndustryCount():  " + industry.GetIndustryCount());
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   105
	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
   106
		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
   107
		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
   108
		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
   109
		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
   110
		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
   111
	}
b10064d51d98 (svn 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
	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
   113
	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
   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
b10064d51d98 (svn 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
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
   117
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   118
	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
   119
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   120
	print("");
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   121
	print("--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
   122
	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
   123
	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
   124
	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
   125
	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
   126
	print("  GetTileY(123):    " + map.GetTileY(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
   127
	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
   128
	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
   129
	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
   130
	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
   131
	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
   132
	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
   133
	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
   134
	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
   135
	print("  DemolishTile():   " + map.DemolishTile(19592));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   136
	print("  DemolishTile():   " + map.DemolishTile(19335));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   137
	print("  Distance");
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   138
	print("    DistanceManhattan(): " + map.DistanceManhattan(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   139
	print("    DistanceMax():       " + map.DistanceMax(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   140
	print("    DistanceSquare():    " + map.DistanceSquare(1, 10000));
1aeee24046d8 (svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents: 9487
diff changeset
   141
	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
   142
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   143
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   144
function Regression::Road()
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   145
{
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   146
	local company = AICompany();
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   147
	local road = AIRoad();
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   148
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   149
	print("");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   150
	print("--Road--");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   151
	print("  Road");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   152
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   153
	print("    IsRoadTile():        " + road.IsRoadTile(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   154
	print("    BuildRoad():         " + road.BuildRoad(0, 1));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   155
	print("    BuildRoad():         " + road.BuildRoad(33411, 33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   156
	print("    BuildRoad():         " + road.BuildRoad(33411, 33414));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   157
	print("    IsRoadTile():        " + road.IsRoadTile(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   158
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   159
	print("    RemoveRoad():        " + road.RemoveRoad(33411, 33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   160
	print("    RemoveRoad():        " + road.RemoveRoad(33411, 33412));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   161
	print("    RemoveRoad():        " + road.RemoveRoad(19590, 19590));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   162
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   163
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   164
	print("  Depot");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   165
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   166
	print("    IsRoadTile():        " + road.IsRoadTile(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   167
	print("    BuildRoadDepot():    " + road.BuildRoadDepot(0, 1));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   168
	print("    BuildRoadDepot():    " + road.BuildRoadDepot(33411, 33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   169
	print("    BuildRoadDepot():    " + road.BuildRoadDepot(33411, 33414));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   170
	print("    BuildRoadDepot():    " + road.BuildRoadDepot(33411, 33412));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   171
	print("    IsRoadTile():        " + road.IsRoadTile(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   172
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   173
	print("    RemoveRoadDepot():   " + road.RemoveRoadDepot(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   174
	print("    RemoveRoadDepot():   " + road.RemoveRoadDepot(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   175
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   176
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   177
	print("  Station");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   178
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   179
	print("    IsRoadTile():        " + road.IsRoadTile(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   180
	print("    BuildRoadStation():  " + road.BuildRoadStation(0, 1));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   181
	print("    BuildRoadStation():  " + road.BuildRoadStation(33411, 33411, false, false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   182
	print("    BuildRoadStation():  " + road.BuildRoadStation(33411, 33414, false, false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   183
	print("    BuildRoadStation():  " + road.BuildRoadStation(33411, 33412, false, false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   184
	print("    IsRoadTile():        " + road.IsRoadTile(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   185
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   186
	print("    RemoveRoadStation(): " + road.RemoveRoadStation(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   187
	print("    RemoveRoadStation(): " + road.RemoveRoadStation(33411));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   188
	print("    GetBankBalance():    " + company.GetBankBalance());
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   189
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   190
	print("  Station Types");
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   191
	print("    BuildRoadStation(truck):       " + road.BuildRoadStation(33411, 33410, false, false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   192
	print("    BuildRoadStation(bus):         " + road.BuildRoadStation(33412, 33413, true,  false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   193
	print("    BuildRoadStation(truck):       " + road.BuildRoadStation(33411 + 256, 33411, false, false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   194
	print("    BuildRoadStation(bus):         " + road.BuildRoadStation(33412 + 256, 33412 + 256 + 256, true,  false));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   195
	print("    BuildRoadStation(truck-drive): " + road.BuildRoadStation(33413, 33412, false, true));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   196
	print("    BuildRoadStation(bus-drive):   " + road.BuildRoadStation(33414, 33413, true,  true));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   197
	print("    BuildRoadStation(truck-drive): " + road.BuildRoadStation(33415, 33414, false, true));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   198
	print("    BuildRoadStation(bus-drive):   " + road.BuildRoadStation(33416, 33415, true,  true));
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   199
}
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   200
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   201
function Regression::Sign()
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   202
{
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   203
	local sign = AISign();
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   204
	local j = 0;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   205
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   206
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   207
	print("--Sign--");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   208
	print("  BuildSign(33410, 'Some Sign'):       " + sign.BuildSign(33410, "Some Sign"));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   209
	local sign_id = sign.BuildSign(33409, "Some other Sign");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   210
	print("  BuildSign(33409, 'Some other Sign'): " + sign_id);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   211
	print("  RemoveSign(" + sign_id + "):                       " + sign.RemoveSign(sign_id));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   212
	print("");
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   213
	print("  GetMaxSignID():    " + sign.GetMaxSignID());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   214
	print("  GetSignCount():    " + sign.GetSignCount());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   215
	for (local i = -1; i < sign.GetMaxSignID() + 1; i++) {
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   216
		if (sign.IsValidSign(i)) j++;
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   217
		print("  Sign " + i);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   218
		print("    IsValidSign():   " + sign.IsValidSign(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   219
		print("    GetText():       " + sign.GetText(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   220
		print("    GetLocation():   " + sign.GetLocation(i));
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   221
	}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   222
	print("  Valid Signs:       " + j);
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   223
	print("  GetSignCount():    " + sign.GetSignCount());
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   224
}
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   225
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
   226
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
   227
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   228
	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
   229
	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
   230
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   231
	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
   232
	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
   233
	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
   234
	print("  GetTownCount():    " + town.GetTownCount());
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   235
	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
   236
		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
   237
		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
   238
		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
   239
		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
   240
		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
   241
		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
   242
	}
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   243
	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
   244
	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
   245
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   246
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   247
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   248
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
   249
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   250
	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
   251
	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
   252
	this.Base();
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   253
	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
   254
	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
   255
	this.Industry();
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   256
	this.Map();
9485
df09b849ca60 (svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents: 9470
diff changeset
   257
	this.Road();
9511
f767ad06e86b (svn r9407) [NoAI] -Add: placing of signs.
rubidium
parents: 9492
diff changeset
   258
	this.Sign();
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
   259
	this.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
   260
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   261
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   262
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
   263
{
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   264
	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
   265
}
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   266
b10064d51d98 (svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff changeset
   267
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
   268
	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
   269
	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
   270
	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
   271
	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
   272
	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
   273
	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
   274
}
b10064d51d98 (svn 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
b10064d51d98 (svn 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
/* 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
   277
 *  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
   278
 *  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
   279
 * 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
   280
 *  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
   281
iFRegression <-FRegression();