author | truelight |
Fri, 04 May 2007 15:57:29 +0000 | |
branch | noai |
changeset 9611 | 5cf58c6571b7 |
parent 9609 | f0dbf5850145 |
child 9614 | 814c3bbf8ecc |
permissions | -rw-r--r-- |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
1 |
class Regression extends AIController { |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
2 |
stop = false; |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
3 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
4 |
function Start(); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
5 |
function Stop(); |
9461
ab1079656642
(svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
9460
diff
changeset
|
6 |
|
ab1079656642
(svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
9460
diff
changeset
|
7 |
constructor() { } |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
8 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
9 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
10 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
11 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
12 |
function Regression::TestInit() |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
13 |
{ |
9553
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
14 |
local settings = AISettings(); |
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
15 |
|
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
16 |
print(""); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
17 |
print("--TestInit--"); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
18 |
print(" TickTest: " + this.GetTick()); |
9557
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
19 |
this.Sleep(1); |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
20 |
print(" TickTest: " + this.GetTick()); |
9553
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
21 |
print(" SetCommandDelay: " + settings.SetCommandDelay(1)); |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
22 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
23 |
|
9487
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
24 |
function Regression::Std() |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
25 |
{ |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
26 |
print(""); |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
27 |
print("--Std--"); |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
28 |
print(" abs(-21): " + abs(-21)); |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
29 |
print(" abs( 21): " + abs(21)); |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
30 |
} |
0575126e0267
(svn r9356) [NoAI] -Add: add abs() function to global scope in SQ. This means we now have an own squirrel_std class which registers such functions. (on request by Zuu)
truelight
parents:
9485
diff
changeset
|
31 |
|
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
32 |
function Regression::Base() |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
33 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
34 |
local base = AIBase(); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
35 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
36 |
print(""); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
37 |
print("--AIBase--"); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
38 |
print(" Rand(): " + base.Rand()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
39 |
print(" Rand(): " + base.Rand()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
40 |
print(" Rand(): " + base.Rand()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
41 |
print(" RandRange(0): " + base.RandRange(0)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
42 |
print(" RandRange(0): " + base.RandRange(0)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
43 |
print(" RandRange(0): " + base.RandRange(0)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
44 |
print(" RandRange(1): " + base.RandRange(1)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
45 |
print(" RandRange(1): " + base.RandRange(1)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
46 |
print(" RandRange(1): " + base.RandRange(1)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
47 |
print(" RandRange(2): " + base.RandRange(2)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
48 |
print(" RandRange(2): " + base.RandRange(2)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
49 |
print(" RandRange(2): " + base.RandRange(2)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
50 |
print(" RandRange(9): " + base.RandRange(9)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
51 |
print(" RandRange(9): " + base.RandRange(9)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
52 |
print(" RandRange(9): " + base.RandRange(9)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
53 |
print(" Chance(1, 2): " + base.Chance(1, 2)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
54 |
print(" Chance(1, 2): " + base.Chance(1, 2)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
55 |
print(" Chance(1, 2): " + base.Chance(1, 2)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
56 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
57 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
58 |
function Regression::Cargo() |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
59 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
60 |
local cargo = AICargo(); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
61 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
62 |
print(""); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
63 |
print("--AICargo--"); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
64 |
for (local i = -1; i < 15; i++) { |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
65 |
print(" Cargo " + i); |
9553
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
66 |
print(" IsValidCargo(): " + cargo.IsValidCargo(i)); |
9461
ab1079656642
(svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
9460
diff
changeset
|
67 |
print(" GetCargoLabel(): '" + cargo.GetCargoLabel(i)+ "'"); |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
68 |
print(" IsFreight(): " + cargo.IsFreight(i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
69 |
print(" GetCargoIncome(0, 0): " + cargo.GetCargoIncome(0, 0, i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
70 |
print(" GetCargoIncome(10, 10): " + cargo.GetCargoIncome(10, 10, i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
71 |
print(" GetCargoIncome(100, 10): " + cargo.GetCargoIncome(100, 10, i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
72 |
print(" GetCargoIncome(10, 100): " + cargo.GetCargoIncome(10, 100, i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
73 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
74 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
75 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
76 |
function Regression::Company() |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
77 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
78 |
local company = AICompany(); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
79 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
80 |
print(""); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
81 |
print("--Company--"); |
9558
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
82 |
|
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
83 |
/* Test AIXXXMode() in scopes */ |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
84 |
{ |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
85 |
local test = AITestMode(); |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
86 |
print(" SetCompanyName(): " + company.SetCompanyName("Regression")); |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
87 |
print(" SetCompanyName(): " + company.SetCompanyName("Regression")); |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
88 |
{ |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
89 |
local exec = AIExecMode(); |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
90 |
print(" SetCompanyName(): " + company.SetCompanyName("Regression")); |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
91 |
print(" SetCompanyName(): " + company.SetCompanyName("Regression")); |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
92 |
} |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
93 |
} |
4fc9b464a932
(svn r9496) [NoAI] -Add: added regression for AITestMode() and AIExecMode()
truelight
parents:
9557
diff
changeset
|
94 |
|
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
95 |
print(" GetCompanyName(): " + company.GetCompanyName()); |
9575
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9560
diff
changeset
|
96 |
print(" GetPresidentName(): " + company.GetPresidentName()); |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9560
diff
changeset
|
97 |
print(" SetPresidentName(): " + company.SetPresidentName("Regression AI")); |
a4b6bbfa6c96
(svn r9591) [NoAI] -Fix: SetCompanyName() in fact set the president name (Zuu)
truelight
parents:
9560
diff
changeset
|
98 |
print(" GetPresidentName(): " + company.GetPresidentName()); |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
99 |
print(" GetCompanyValue(): " + company.GetCompanyValue()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
100 |
print(" GetBankBalance(): " + company.GetBankBalance()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
101 |
print(" GetLoanAmount(): " + company.GetLoanAmount()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
102 |
print(" GetMaxLoanAmount(): " + company.GetMaxLoanAmount()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
103 |
print(" GetLoanInterval(): " + company.GetLoanInterval()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
104 |
print(" SetLoanAmount(1): " + company.SetLoanAmount(1)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
105 |
print(" SetLoanAmount(100): " + company.SetLoanAmount(100)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
106 |
print(" SetLoanAmount(10000): " + company.SetLoanAmount(10000)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
107 |
print(" GetBankBalance(): " + company.GetBankBalance()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
108 |
print(" GetLoanAmount(): " + company.GetLoanAmount()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
109 |
print(" SetLoanAmount(10000): " + company.SetLoanAmount(company.GetMaxLoanAmount())); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
110 |
print(" GetBankBalance(): " + company.GetBankBalance()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
111 |
print(" GetLoanAmount(): " + company.GetLoanAmount()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
112 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
113 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
114 |
function Regression::Industry() |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
115 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
116 |
local industry = AIIndustry(); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
117 |
local j = 0; |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
118 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
119 |
print(""); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
120 |
print("--Industry--"); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
121 |
print(" GetMaxIndustryID(): " + industry.GetMaxIndustryID()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
122 |
print(" GetIndustryCount(): " + industry.GetIndustryCount()); |
9511 | 123 |
for (local i = -1; i < industry.GetMaxIndustryID() + 1; i++) { |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
124 |
if (industry.IsValidIndustry(i)) j++; |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
125 |
print(" Industry " + i); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
126 |
print(" IsValidIndustry(): " + industry.IsValidIndustry(i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
127 |
print(" GetName(): " + industry.GetName(i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
128 |
print(" GetLocation(): " + industry.GetLocation(i)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
129 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
130 |
print(" Valid Industries: " + j); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
131 |
print(" GetIndustryCount(): " + industry.GetIndustryCount()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
132 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
133 |
|
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
134 |
function Regression::List() |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
135 |
{ |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
136 |
local list = AIList(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
137 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
138 |
print(""); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
139 |
print("--List--"); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
140 |
|
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
141 |
print(" IsEmpty(): " + list.IsEmpty()); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
142 |
list.AddItem(1); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
143 |
list.AddItem(2); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
144 |
for (local i = 1000; i < 1100; i++) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
145 |
list.AddItem(i); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
146 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
147 |
list.RemoveItem(1050); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
148 |
list.RemoveItem(1150); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
149 |
print(" Count(): " + list.Count()); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
150 |
print(" HasItem(1050): " + list.HasItem(1050)); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
151 |
print(" HasItem(1051): " + list.HasItem(1051)); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
152 |
print(" IsEmpty(): " + list.IsEmpty()); |
9585
1300741e3230
(svn r9610) [NoAI] -Fix r9604: forgot to update regression
truelight
parents:
9579
diff
changeset
|
153 |
list.SortByItem(true); |
9579
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
154 |
print(" List Dump:"); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
155 |
for (local i = list.Begin(); list.HasNext(); i = list.Next()) { |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
156 |
print(" " + i + " => " + list.GetValue(i)); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
157 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
158 |
list.Clear(); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
159 |
print(" IsEmpty(): " + list.IsEmpty()); |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
160 |
} |
632263c0cf5a
(svn r9603) [NoAI] -Add: added AIList(), a simple list in which you can add item/value pairs. You can sort them, walk them, and valuate them
truelight
parents:
9575
diff
changeset
|
161 |
|
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
162 |
function Regression::Map() |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
163 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
164 |
local map = AIMap(); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
165 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
166 |
print(""); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
167 |
print("--Map--"); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
168 |
print(" GetMapSize(): " + map.GetMapSize()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
169 |
print(" GetMapSizeX(): " + map.GetMapSizeX()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
170 |
print(" GetMapSizeY(): " + map.GetMapSizeY()); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
171 |
print(" GetTileX(123): " + map.GetTileX(123)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
172 |
print(" GetTileY(123): " + map.GetTileY(123)); |
9553
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
173 |
print(" GetTileIndex(): " + map.GetTileIndex(123, 0)); |
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
174 |
print(" GetTileIndex(): " + map.GetTileIndex(0, 123)); |
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
175 |
print(" GetTileIndex(): " + map.GetTileIndex(0, 0)); |
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
176 |
print(" GetTileIndex(): " + map.GetTileIndex(-1, -1)); |
23967657558b
(svn r9491) [NoAI] -Fix: added some missing commands to the regression test (some are still missing)
truelight
parents:
9546
diff
changeset
|
177 |
print(" GetTileIndex(): " + map.GetTileIndex(10000, 10000)); |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
178 |
print(" IsValidTile(123): " + map.IsValidTile(123)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
179 |
print(" GetTileX(124): " + map.GetTileX(124)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
180 |
print(" GetTileY(124): " + map.GetTileY(124)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
181 |
print(" IsValidTile(124): " + map.IsValidTile(124)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
182 |
print(" IsValidTile(0): " + map.IsValidTile(0)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
183 |
print(" IsValidTile(-1): " + map.IsValidTile(-1)); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
184 |
print(" IsValidTile(): " + map.IsValidTile(map.GetMapSize())); |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
185 |
print(" IsValidTile(): " + map.IsValidTile(map.GetMapSize() - 1)); |
9492
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
186 |
print(" DemolishTile(): " + map.DemolishTile(19592)); |
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
187 |
print(" DemolishTile(): " + map.DemolishTile(19335)); |
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
188 |
print(" Distance"); |
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
189 |
print(" DistanceManhattan(): " + map.DistanceManhattan(1, 10000)); |
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
190 |
print(" DistanceMax(): " + map.DistanceMax(1, 10000)); |
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
191 |
print(" DistanceSquare(): " + map.DistanceSquare(1, 10000)); |
1aeee24046d8
(svn r9362) [NoAI] -Add: added the new AIMap() functions to regression-test
truelight
parents:
9487
diff
changeset
|
192 |
print(" DistanceFromEdge(): " + map.DistanceFromEdge(10000)); |
9460
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
193 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
194 |
|
9546
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
195 |
function Regression::Order() |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
196 |
{ |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
197 |
local order = AIOrder(); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
198 |
|
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
199 |
print(""); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
200 |
print("--Order--"); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
201 |
print(" GetNumberOfOrders(): " + order.GetNumberOfOrders(1024)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
202 |
print(" GetOrderDestination(): " + order.GetOrderDestination(1024, 1)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
203 |
print(" AreOrderFlagsValid(): " + order.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
204 |
print(" IsValidVehicleOrder(): " + order.IsValidVehicleOrder(1024, 1)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
205 |
print(" GetOrderFlags(): " + order.GetOrderFlags(1024, 1)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
206 |
print(" AppendOrder(): " + order.AppendOrder(1024, 33416, AIOrder.AIOF_TRANSFER)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
207 |
print(" InsertOrder(): " + order.InsertOrder(1024, 0, 33416, AIOrder.AIOF_TRANSFER)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
208 |
print(" GetNumberOfOrders(): " + order.GetNumberOfOrders(1024)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
209 |
print(" IsValidVehicleOrder(): " + order.IsValidVehicleOrder(1024, 1)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
210 |
print(" RemoveOrder(): " + order.RemoveOrder(1024, 0)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
211 |
print(" ChangeOrder(): " + order.ChangeOrder(1024, 0, AIOrder.AIOF_FULL_LOAD)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
212 |
print(" GetOrderDestination(): " + order.GetOrderDestination(1024, 0)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
213 |
print(" CopyOrders(): " + order.CopyOrders(1025, 1)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
214 |
print(" CopyOrders(): " + order.CopyOrders(1025, 1024)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
215 |
print(" ShareOrders(): " + order.ShareOrders(1025, 1)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
216 |
print(" ShareOrders(): " + order.ShareOrders(1025, 1024)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
217 |
print(" UnshareOrders(): " + order.UnshareOrders(1025)); |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
218 |
} |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
219 |
|
9485
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
220 |
function Regression::Road() |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
221 |
{ |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
222 |
local road = AIRoad(); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
223 |
|
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
224 |
print(""); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
225 |
print("--Road--"); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
226 |
print(" Road"); |
9555
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
227 |
print(" IsRoadTile(): " + road.IsRoadTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
228 |
print(" BuildRoad(): " + road.BuildRoad(0, 1)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
229 |
print(" BuildRoad(): " + road.BuildRoad(33411, 33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
230 |
print(" BuildRoad(): " + road.BuildRoad(33411, 33414)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
231 |
print(" AreRoadTilesConnected(): " + road.AreRoadTilesConnected(33412, 33413)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
232 |
print(" IsRoadTile(): " + road.IsRoadTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
233 |
print(" RemoveRoad(): " + road.RemoveRoad(33411, 33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
234 |
print(" RemoveRoad(): " + road.RemoveRoad(33411, 33412)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
235 |
print(" RemoveRoad(): " + road.RemoveRoad(19590, 19590)); |
9485
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
236 |
|
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
237 |
print(" Depot"); |
9555
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
238 |
print(" IsRoadTile(): " + road.IsRoadTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
239 |
print(" BuildRoadDepot(): " + road.BuildRoadDepot(0, 1)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
240 |
print(" BuildRoadDepot(): " + road.BuildRoadDepot(33411, 33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
241 |
print(" BuildRoadDepot(): " + road.BuildRoadDepot(33411, 33414)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
242 |
print(" BuildRoadDepot(): " + road.BuildRoadDepot(33411, 33412)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
243 |
print(" IsRoadTile(): " + road.IsRoadTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
244 |
print(" GetRoadDepotFrontTile(): " + road.GetRoadDepotFrontTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
245 |
print(" IsRoadDepotTile(): " + road.IsRoadDepotTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
246 |
print(" RemoveRoadDepot(): " + road.RemoveRoadDepot(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
247 |
print(" RemoveRoadDepot(): " + road.RemoveRoadDepot(33411)); |
9485
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
248 |
|
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
249 |
print(" Station"); |
9555
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
250 |
print(" IsRoadTile(): " + road.IsRoadTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
251 |
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
|
252 |
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
|
253 |
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
|
254 |
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
|
255 |
print(" IsRoadTile(): " + road.IsRoadTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
256 |
print(" GetDriveThroughBackTile(): " + road.GetDriveThroughBackTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
257 |
print(" GetRoadStationFrontTile(): " + road.GetRoadStationFrontTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
258 |
print(" IsRoadStationTile(): " + road.IsRoadStationTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
259 |
print(" IsDriveThroughRoadStationTile: " + road.IsDriveThroughRoadStationTile(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
260 |
print(" RemoveRoadStation(): " + road.RemoveRoadStation(33411)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
261 |
print(" RemoveRoadStation(): " + road.RemoveRoadStation(33411)); |
9485
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
262 |
|
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
263 |
print(" Station Types"); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
264 |
print(" BuildRoadStation(truck): " + road.BuildRoadStation(33411, 33410, false, false)); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
265 |
print(" BuildRoadStation(bus): " + road.BuildRoadStation(33412, 33413, true, false)); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
266 |
print(" BuildRoadStation(truck): " + road.BuildRoadStation(33411 + 256, 33411, false, false)); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
267 |
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
|
268 |
print(" BuildRoadStation(truck-drive): " + road.BuildRoadStation(33413, 33412, false, true)); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
269 |
print(" BuildRoadStation(bus-drive): " + road.BuildRoadStation(33414, 33413, true, true)); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
270 |
print(" BuildRoadStation(truck-drive): " + road.BuildRoadStation(33415, 33414, false, true)); |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
271 |
print(" BuildRoadStation(bus-drive): " + road.BuildRoadStation(33416, 33415, true, true)); |
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
272 |
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
|
273 |
print(" GetRoadStationFrontTile(): " + road.GetRoadStationFrontTile(33411 + 256)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
274 |
print(" GetRoadStationFrontTile(): " + road.GetRoadStationFrontTile(33412 + 256)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
275 |
print(" IsDriveThroughRoadStationTile: " + road.IsDriveThroughRoadStationTile(33415)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
276 |
print(" GetDriveThroughBackTile(): " + road.GetDriveThroughBackTile(33415)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
277 |
print(" GetRoadStationFrontTile(): " + road.GetRoadStationFrontTile(33415)); |
00ccc64d342c
(svn r9493) [NoAI] -Add: added the missing AIRoad() functions to regression-test
truelight
parents:
9553
diff
changeset
|
278 |
print(" IsRoadTile(): " + road.IsRoadTile(33415)); |
9485
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
279 |
} |
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
280 |
|
9511 | 281 |
function Regression::Sign() |
282 |
{ |
|
283 |
local sign = AISign(); |
|
284 |
local j = 0; |
|
285 |
||
286 |
print(""); |
|
287 |
print("--Sign--"); |
|
288 |
print(" BuildSign(33410, 'Some Sign'): " + sign.BuildSign(33410, "Some Sign")); |
|
289 |
local sign_id = sign.BuildSign(33409, "Some other Sign"); |
|
290 |
print(" BuildSign(33409, 'Some other Sign'): " + sign_id); |
|
291 |
print(" RemoveSign(" + sign_id + "): " + sign.RemoveSign(sign_id)); |
|
292 |
print(""); |
|
293 |
print(" GetMaxSignID(): " + sign.GetMaxSignID()); |
|
294 |
print(" GetSignCount(): " + sign.GetSignCount()); |
|
295 |
for (local i = -1; i < sign.GetMaxSignID() + 1; i++) { |
|
296 |
if (sign.IsValidSign(i)) j++; |
|
297 |
print(" Sign " + i); |
|
298 |
print(" IsValidSign(): " + sign.IsValidSign(i)); |
|
299 |
print(" GetText(): " + sign.GetText(i)); |
|
300 |
print(" GetLocation(): " + sign.GetLocation(i)); |
|
301 |
} |
|
302 |
print(" Valid Signs: " + j); |
|
303 |
print(" GetSignCount(): " + sign.GetSignCount()); |
|
304 |
} |
|
305 |
||
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
306 |
function Regression::TileList() |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
307 |
{ |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
308 |
local list = AITileList(); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
309 |
|
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
310 |
print(""); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
311 |
print("--TileList--"); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
312 |
print(" Count(): " + list.Count()); |
9605
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
313 |
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
|
314 |
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
|
315 |
|
9611
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
print(" ListDump:"); |
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
322 |
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
|
323 |
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
|
324 |
} |
5cf58c6571b7
(svn r9776) [NoAI] -Add: added AITileListSlope as valuator to see if tiles are flat or not
truelight
parents:
9609
diff
changeset
|
325 |
|
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
326 |
list.Valuate(AITileListBuildable()); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
327 |
list.KeepValue(1); |
9605
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
328 |
print(" Buildable(): done"); |
9609
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
329 |
print(" KeepValue(1): done"); |
9605
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
330 |
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
|
331 |
|
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
332 |
list.Valuate(AITileListCargoAcceptance(0)); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
333 |
list.KeepAboveValue(10); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
334 |
print(" CargoAcceptance(): done"); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
335 |
print(" KeepAboveValue(10): done"); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
336 |
print(" Count(): " + list.Count()); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
337 |
print(" ListDump:"); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
338 |
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
|
339 |
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
|
340 |
} |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
341 |
|
9605
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
342 |
list.Valuate(AITileListRoadTile()); |
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
343 |
list.KeepValue(1); |
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
344 |
print(" RoadTile(): done"); |
9609
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
345 |
print(" KeepValue(1): done"); |
9605
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
346 |
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
|
347 |
print(" ListDump:"); |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
348 |
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
|
349 |
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
|
350 |
} |
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
351 |
|
9605
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
352 |
list.Valuate(AITileListNeighbourRoad()); |
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
353 |
list.KeepValue(1); |
2c2348827b52
(svn r9749) [NoAI] -Add: added regression-test for new AITileList valuators
truelight
parents:
9592
diff
changeset
|
354 |
print(" NeighbourRoad(): done"); |
9609
f0dbf5850145
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents:
9605
diff
changeset
|
355 |
print(" KeepValue(1): done"); |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
356 |
print(" Count(): " + list.Count()); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
357 |
print(" ListDump:"); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
358 |
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
|
359 |
print(" " + i + " => " + list.GetValue(i)); |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
360 |
} |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
361 |
} |
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
362 |
|
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
|
363 |
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
|
364 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
365 |
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
|
366 |
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
|
367 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
print(" GetTownCount(): " + town.GetTownCount()); |
9511 | 372 |
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
|
373 |
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
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
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
|
379 |
} |
9511 | 380 |
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
|
381 |
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
|
382 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
383 |
|
9589
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
384 |
function Regression::TownList() |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
385 |
{ |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
386 |
local list = AITownList(); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
387 |
|
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
388 |
print(""); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
389 |
print("--TownList--"); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
390 |
print(" Count(): " + list.Count()); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
391 |
list.Valuate(AITownListGetPopulation()); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
392 |
list.KeepAboveValue(500); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
393 |
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
|
394 |
print(" Count(): " + list.Count()); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
395 |
print(" ListDump:"); |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
396 |
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
|
397 |
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
|
398 |
} |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
399 |
} |
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
400 |
|
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
401 |
function Regression::Vehicle() |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
402 |
{ |
9557
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
403 |
local accounting = AIAccounting(); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
404 |
local company = AICompany(); |
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
405 |
local vehicle = AIVehicle(); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
406 |
local j = 0; |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
407 |
|
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
408 |
print(""); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
409 |
print("--Vehicle--"); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
410 |
for (local i = -1; i < 257; i++) { |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
411 |
if (vehicle.IsValidEngine(i)) j++; |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
412 |
print(" Engine " + i); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
413 |
print(" IsValidEngine(): " + vehicle.IsValidEngine(i)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
414 |
} |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
415 |
print(" Valid Engines: " + j); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
416 |
print(" IsValidVehicle(-1): " + vehicle.IsValidVehicle(-1)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
417 |
print(" IsValidVehicle(0): " + vehicle.IsValidVehicle(0)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
418 |
print(" IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
419 |
print(" ISValidVehicle(9999): " + vehicle.IsValidVehicle(9999)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
420 |
|
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
421 |
for (local i = -1; i < 15; i++) { |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
422 |
print(" FindBestRoadVehicle Cargo " + i); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
423 |
print(" Reliability 0: " + vehicle.FindBestRoadVehicle(i, 0)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
424 |
print(" Reliability 50: " + vehicle.FindBestRoadVehicle(i, 50)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
425 |
print(" Reliability 100: " + vehicle.FindBestRoadVehicle(i, 100)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
426 |
} |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
427 |
|
9557
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
428 |
local bank = company.GetBankBalance(); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
429 |
|
9560
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
430 |
{ |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
431 |
local transaction = AITransactionMode(); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
432 |
print(" BuildVehicle(): " + vehicle.BuildVehicle(33417, 153)); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
433 |
print(" IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024)); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
434 |
|
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
435 |
print(" --Transaction--"); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
436 |
print(" GetCosts(): " + transaction.GetCosts()); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
437 |
print(" Execute(): " + transaction.Execute()); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
438 |
|
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
439 |
print(" IsValidVehicle(1024): " + vehicle.IsValidVehicle(1024)); |
ff2dde050a4c
(svn r9498) [NoAI] -Add: added regression for AITransactionMode()
truelight
parents:
9558
diff
changeset
|
440 |
} |
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
441 |
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
|
442 |
|
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
443 |
local bank_after = company.GetBankBalance(); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
444 |
|
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
445 |
print(" --Accounting--"); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
446 |
print(" GetCosts(): " + accounting.GetCosts()); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
447 |
print(" Should be: " + (bank - bank_after)); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
448 |
print(" ResetCosts(): " + accounting.ResetCosts()); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
449 |
|
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
450 |
bank = company.GetBankBalance(); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
451 |
|
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
452 |
print(" SellVehicle(1025): " + vehicle.SellVehicle(1025)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
453 |
print(" StartStopVehicle(): " + vehicle.StartStopVehicle(1024)); |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
454 |
print(" SendVehicleToDepot(): " + vehicle.SendVehicleToDepot(1024)); |
9557
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
455 |
|
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
456 |
bank_after = company.GetBankBalance(); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
457 |
|
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
458 |
print(" --Accounting--"); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
459 |
print(" GetCosts(): " + accounting.GetCosts()); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
460 |
print(" Should be: " + (bank - bank_after)); |
a3e1a25cf3d3
(svn r9495) [NoAI] -Add: add regression for AIAccounting() in AIVehicle() regression
truelight
parents:
9555
diff
changeset
|
461 |
|
9546
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
462 |
print(" CloneVehicle(): " + vehicle.CloneVehicle(33417, 1024, true)); |
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
463 |
} |
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
464 |
|
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
|
465 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
466 |
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
|
467 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
468 |
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
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
this.List(); |
9485
df09b849ca60
(svn r9335) [NoAI] -Update: added AIRoad() regression test
truelight
parents:
9470
diff
changeset
|
476 |
this.Road(); |
9511 | 477 |
this.Sign(); |
9592
c5c09cfde63a
(svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
9589
diff
changeset
|
478 |
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
|
479 |
this.Town(); |
9589
2fbda08db406
(svn r9622) [NoAI] -Add: added AITownList, which lists all towns (and which you can iterate)
truelight
parents:
9585
diff
changeset
|
480 |
this.TownList(); |
9518
b32191854ad9
(svn r9432) [NoAI] -Add: added regression-test for AIVehicle()
truelight
parents:
9511
diff
changeset
|
481 |
this.Vehicle(); |
9546
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
482 |
/* Order has to be after Vehicle */ |
fde20f518285
(svn r9477) [NoAI] -Add: added regression-test for AIOrder()
truelight
parents:
9541
diff
changeset
|
483 |
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
|
484 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
485 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
486 |
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
|
487 |
{ |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
488 |
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
|
489 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
490 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
491 |
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
|
492 |
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
|
493 |
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
|
494 |
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
|
495 |
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
|
496 |
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
|
497 |
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
|
498 |
} |
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
499 |
|
b10064d51d98
(svn r9291) [NoAI] -Add: added the first version of a regression AI, an AI that tests all API functions for consistancy.
truelight
parents:
diff
changeset
|
500 |
/* 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
|
501 |
* 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
|
502 |
* 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
|
503 |
* 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
|
504 |
* 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
|
505 |
iFRegression <-FRegression(); |