|
|
|
@ -3,8 +3,8 @@ |
|
|
|
|
#set -x |
|
|
|
|
|
|
|
|
|
# File locations |
|
|
|
|
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
|
|
|
|
datadir="$dir/data" |
|
|
|
|
#dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) || exit |
|
|
|
|
datadir="./data" |
|
|
|
|
results="$datadir/battle.data" |
|
|
|
|
settings="$datadir/settings.last.battle" |
|
|
|
|
training="$datadir/training.scale.data" |
|
|
|
@ -41,7 +41,7 @@ generate_data() { |
|
|
|
|
|
|
|
|
|
# If the data file has required amount if data |
|
|
|
|
lines=$(wc -l < "$results") |
|
|
|
|
if [ "$lines" -lt "$rounds" ] ; then |
|
|
|
|
if [[ "$lines" -lt "$rounds" ]] ; then |
|
|
|
|
# Repeat the battle desired number of times (till the battle data file does not contain $rounds entries |
|
|
|
|
echo "Generating the data for SVM predition. Depending on the machine, this may take very long time." |
|
|
|
|
delta=$((rounds - lines)) |
|
|
|
@ -65,7 +65,7 @@ generate_data() { |
|
|
|
|
} > "$settings" |
|
|
|
|
|
|
|
|
|
# Run battle without GUI, following the settings file, and returning the lines containing winners |
|
|
|
|
winner=$(robocode -nodisplay -battle "$settings" | tail -2| awk 'NR==1F {print $2}') |
|
|
|
|
winner=$(robocode -nodisplay -battle "$(pwd)/$settings" | tail -2| awk 'NR==1F {print $2}') |
|
|
|
|
if [ "$winner" == "$robot1" ] ; then |
|
|
|
|
winner=1 |
|
|
|
|
else |
|
|
|
@ -79,7 +79,7 @@ generate_data() { |
|
|
|
|
done |
|
|
|
|
printf "\nData generation has been successful.\n\n" |
|
|
|
|
else |
|
|
|
|
if [ "$1" == "verbose" ] ; then |
|
|
|
|
if [[ "$1" == "verbose" ]] ; then |
|
|
|
|
echo "Data have already been generated. Show accuracy or run the battle." |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
@ -133,6 +133,3 @@ while :; do |
|
|
|
|
command shift |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|