Improved AI testing (#3184)

* New command line option for testing

* Fix command line option

* Allow races from command line without player kart

* Use the new command line option for testing

Also increase the default number of karts for testing from 9 (including player kart) to 15 (no player kart) for reduced randomness.
And set the default test difficulty to SuperTux
This commit is contained in:
Alayan-stk-2 2018-04-15 03:07:12 +02:00 committed by auriamg
parent ff55703457
commit 8f2c118e33
3 changed files with 14 additions and 4 deletions

View File

@ -548,7 +548,8 @@ void cmdLineHelp()
"./data/stk_config.xml\n"
" -k, --numkarts=NUM Set number of karts on the racetrack.\n"
" --kart=NAME Use kart NAME.\n"
" --ai=a,b,... Use the karts a, b, ... for the AI.\n"
" --ai=a,b,... Use the karts a, b, ... for the AI, and additional player kart.\n"
" --aiNP=a,b,... Use the karts a, b, ... for the AI, no additional player kart.\n"
" --laps=N Define number of laps to N.\n"
" --mode=N N=1 Beginner, N=2 Intermediate, N=3 Expert, N=4 SuperTux.\n"
" --type=N N=0 Normal, N=1 Time trial, N=2 Follow The Leader\n"
@ -1113,6 +1114,13 @@ int handleCmdLine()
race_manager->setNumKarts((int)l.size()+1);
} // --ai
if(CommandLine::has("--aiNP", &s))
{
const std::vector<std::string> l=StringUtils::split(std::string(s),',');
race_manager->setDefaultAIKartList(l);
race_manager->setNumKarts((int)l.size());
} // --aiNP
if(CommandLine::has( "--mode", &s) || CommandLine::has( "--difficulty", &s))
{
int n = atoi(s.c_str());

View File

@ -280,7 +280,9 @@ void RaceManager::computeRandomKartList()
}
m_ai_kart_list.clear();
unsigned int m = std::min( (unsigned) n, (unsigned)m_default_ai_list.size());
//Use the command line options AI list.
unsigned int m = std::min( (unsigned) m_num_karts, (unsigned)m_default_ai_list.size());
for(unsigned int i=0; i<m; i++)
{

View File

@ -3,7 +3,7 @@
for track in abyss candela_city cocoa_temple cornfield_crossing fortmagma gran_paradiso_island greenvalley hacienda lighthouse mansion mines minigolf olivermath sandtrack scotland snowmountain snowtuxpeak stk_enterprise volcano_island xr591 zengarden; do
echo "Testing $track"
$1 --log=0 -R \
--ai=nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok \
--track=$track --difficulty=2 --type=1 --test-ai=2 \
--aiNP=nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok \
--track=$track --difficulty=3 --type=1 --test-ai=2 \
--profile-laps=10 --no-graphics > stdout.$track
done