From c4d4c1c0b333591f883f4ba18ea079441e05058d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Babi=C4=8D?= Date: Sun, 26 Apr 2015 19:33:32 +0200 Subject: [PATCH] changed to relative path --- robocode-svm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/robocode-svm b/robocode-svm index 3e4b868..b914352 100755 --- a/robocode-svm +++ b/robocode-svm @@ -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 - - -