Here's a utility I quickly made up so I can evaluate the effectiveness of changes I make to the
LunarTwins. The advantage of this as opposed to just tuning up the number of rounds, is that 2 trials of 75 rounds is different than 1 trial of 150 rounds when bots that learn between rounds are concerned. It's tuned to get the survival rate according to the
TwinDuel rules, but it wouldn't be hard to adapt to other things. It probably would have been more flexible to adapt
RoboResearch to support survival tests like this, however I thought it would be easier to hack up my own quick solution. Here's the script I hacked up for anyone interested.
#!/bin/sh
# Configuration
TRIALS=20
ROUNDS=75
TESTNAME="LunarTest"
MYROBOT="ags.lunartwins.LunarTwins"
ENEMYBOT="voidious.team.LuminariousDuo 1.0591"
FIELDWIDTH=800
FIELDHEIGHT=800
# Init things
RESULTFILE="${TESTNAME}.result"
TMPFILE="${TESTNAME}.tmp"
BATTLEFILE="${TESTNAME}.battle"
echo > ${RESULTFILE}
TOTAL=0
# Generate Battle File
echo "#${TESTNAME} Battle File" > ${BATTLEFILE}
echo "robocode.battle.numRounds=${ROUNDS}" >> ${BATTLEFILE}
echo "robocode.battle.gunCoolingRate=0.1" >> ${BATTLEFILE}
echo "robocode.battleField.width=${FIELDWIDTH}" >> ${BATTLEFILE}
echo "robocode.battle.rules.inactivityTime=450" >> ${BATTLEFILE}
echo "robocode.battle.selectedRobots=${MYROBOT},${ENEMYBOT}" >> ${BATTLEFILE}
echo "robocode.battleField.height=${FIELDHEIGHT}" >> ${BATTLEFILE}
# Run the trials
echo "${TESTNAME} Survival Rates" >> ${RESULTFILE}
for i in `seq 1 ${TRIALS}`;
do
echo "Trial ${i}..."
./robocode.sh -battle "./${BATTLEFILE}" -results "./${TMPFILE}" -nodisplay 2>&1 | grep "initializing"
VALUE=`cat LunarTest.tmp | grep "${MYROBOT}" | cut -d $'\t' -f 9`
VALUE=`echo "100*${VALUE}/${ROUNDS}" | bc -l`
TOTAL=`echo "${VALUE}+${TOTAL}" | bc -l`
echo "Round ${i}: ${VALUE}%" >> ${RESULTFILE}
done
AVERAGE=`echo "${TOTAL}/${TRIALS}" | bc -l`
echo "Average: ${AVERAGE}%" >> ${RESULTFILE}