bit of testing with the scripts for optimal settings
This commit is contained in:
parent
95bb6835ae
commit
e47f85a32c
50
batch.py
50
batch.py
@ -1,6 +1,48 @@
|
||||
from os import listdir
|
||||
for file in listdir('../batch'):
|
||||
f = open('../batch/'+file,'r')
|
||||
for c in f.readlines():
|
||||
print(c)
|
||||
|
||||
def is_numeric(x):
|
||||
try:
|
||||
float(x)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
|
||||
avg_lap_time = [0]*50
|
||||
avg_position = [0]*50
|
||||
avg_speed = [0]*50
|
||||
avg_top = [0]*50
|
||||
total_rescued = [0]*50
|
||||
|
||||
#for entry in ['sara','tux','elephpant','pidgin']:
|
||||
|
||||
tests = len(listdir('../batch'))-1
|
||||
for file in listdir('../batch'):
|
||||
if (file == '.DS_Store'):
|
||||
continue
|
||||
f = open('../batch/'+file,'r')
|
||||
"""
|
||||
name_index = file.find('.')
|
||||
name = str(file[:name_index])
|
||||
first = file.find('.',name_index+1)
|
||||
numkarts = int(file[name_index+1:first])
|
||||
second = file.find('.',first+1)
|
||||
laps = int(file[first+1:second])
|
||||
third = file.find('.',second+1)
|
||||
run = int(file[second+1:third])
|
||||
"""
|
||||
mass = int(file[:file.find('.')])
|
||||
contents = f.readlines()
|
||||
contents = contents[2:contents.index("[debug ] profile: \n")-1]
|
||||
content = [s for s in contents if "sara" in s]
|
||||
data = [float(x) for x in content[0].split() if is_numeric(x)]
|
||||
avg_lap_time[(mass-50)/10] += (data[2]/2)/5
|
||||
avg_position[(mass-50)/10] += data[1]/5
|
||||
avg_speed[(mass-50)/10] += data[3]/5
|
||||
avg_top[(mass-50)/10] += data[4]/5
|
||||
total_rescued[((mass-50)/10)] += data[7]
|
||||
print("total rescue")
|
||||
for i in range(len(avg_lap_time)):
|
||||
print(i*10+50, total_rescued[i])
|
||||
|
||||
|
||||
"""avg_lap_time[i], avg_position[i], avg_speed[i], avg_top[i],"""
|
||||
|
24
test.sh
24
test.sh
@ -1,16 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
#TODO test multiple tracks
|
||||
#TODO fix escape characters
|
||||
|
||||
mkdir -p ../batch
|
||||
count=1
|
||||
|
||||
for run in {1..50}; do
|
||||
for num in {1..4}; do
|
||||
for laps in {2..7}; do
|
||||
./cmake_build/bin/supertuxkart.app/Contents/MacOS/supertuxkart -R --mode=3 --numkarts=$num --with-profile --profile-laps=$laps --no-graphics > /dev/null
|
||||
grep "profile" ~/Library/Application\ Support/SuperTuxKart/stdout.log > ../batch/$run.$num.$laps.txt
|
||||
python batch.py
|
||||
done
|
||||
#for numkarts in 4; do
|
||||
# for laps in 4 10; do
|
||||
for ((mass = 50; mass <= 500; mass=$mass+10)) do
|
||||
sed -i -e "s/mass\ value\ =\ \"[0-9]*/mass\ value\ =\ \"$mass/g" ../stk-assets/karts/sara/kart.xml
|
||||
for run in {1..10}; do
|
||||
echo $count/450
|
||||
./cmake_build/bin/supertuxkart.app/Contents/MacOS/supertuxkart -R --mode=3 --numkarts=1 --with-profile --profile-laps=3 --kart=sara --ai=beastie,beastie,beastie --no-graphics > /dev/null
|
||||
grep "profile" ~/Library/Application\ Support/SuperTuxKart/stdout.log > ../batch/$mass.$run.txt
|
||||
let "count = $count + 1"
|
||||
done
|
||||
done
|
||||
|
||||
for track in "cave" "city" "scotland" "jungle" "lighthouse" "hacienda" "fortmagma"; do
|
||||
./cmake_build/bin/supertuxkart.app/Contents/MacOS/supertuxkart -R --mode=3 --track=$track --with-profile --profile-laps=1 > /dev/null
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user