changed to relative path

master
Peter Babič 9 years ago
parent 107d8d59d9
commit c4d4c1c0b3
  1. 13
      robocode-svm

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

Loading…
Cancel
Save