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:
parent
ff55703457
commit
8f2c118e33
10
src/main.cpp
10
src/main.cpp
@ -548,7 +548,8 @@ void cmdLineHelp()
|
|||||||
"./data/stk_config.xml\n"
|
"./data/stk_config.xml\n"
|
||||||
" -k, --numkarts=NUM Set number of karts on the racetrack.\n"
|
" -k, --numkarts=NUM Set number of karts on the racetrack.\n"
|
||||||
" --kart=NAME Use kart NAME.\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"
|
" --laps=N Define number of laps to N.\n"
|
||||||
" --mode=N N=1 Beginner, N=2 Intermediate, N=3 Expert, N=4 SuperTux.\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"
|
" --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);
|
race_manager->setNumKarts((int)l.size()+1);
|
||||||
} // --ai
|
} // --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))
|
if(CommandLine::has( "--mode", &s) || CommandLine::has( "--difficulty", &s))
|
||||||
{
|
{
|
||||||
int n = atoi(s.c_str());
|
int n = atoi(s.c_str());
|
||||||
|
@ -280,7 +280,9 @@ void RaceManager::computeRandomKartList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_ai_kart_list.clear();
|
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++)
|
for(unsigned int i=0; i<m; i++)
|
||||||
{
|
{
|
||||||
|
@ -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
|
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"
|
echo "Testing $track"
|
||||||
$1 --log=0 -R \
|
$1 --log=0 -R \
|
||||||
--ai=nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok \
|
--aiNP=nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok \
|
||||||
--track=$track --difficulty=2 --type=1 --test-ai=2 \
|
--track=$track --difficulty=3 --type=1 --test-ai=2 \
|
||||||
--profile-laps=10 --no-graphics > stdout.$track
|
--profile-laps=10 --no-graphics > stdout.$track
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user