|
|
@ -1,27 +1,34 @@ |
|
|
|
#!/bin/bash |
|
|
|
if [ $# -lt 1 ]; then |
|
|
|
echo "missing json filename" |
|
|
|
echo "Missing json filename" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
if [ $# -lt 2 ]; then |
|
|
|
echo "missing strategy name" |
|
|
|
echo "Missing strategy name" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
OUTPUT=`dist/build/icfp2015/icfp2015 -f $1|./filterResults.py $2` |
|
|
|
if [ $? -eq 0 ]; then |
|
|
|
problem=`echo $1 | cut -d '_' -f 3` |
|
|
|
if [ "$OUTPUT" == "`cat submitted/$problem 2> /dev/null`" ]; then |
|
|
|
echo "Same solutions alredy submitted, quitting" |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
read -p "Are you sure? [y/n]" -n 1 -r |
|
|
|
echo |
|
|
|
echo $OUTPUT > submitted/$problem |
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then |
|
|
|
exit 1 |
|
|
|
response=`curl --user :2aaFCkjNIDHAsAIh9iQHc+Y+FGhkM5Z0RQgpO6TL6EA= -X POST -H "Content-Type: application/json" -d "$OUTPUT" https://davar.icfpcontest.org/teams/235/solutions` |
|
|
|
if [ "$response" == "created" ]; then |
|
|
|
echo "submitted" |
|
|
|
echo "Submitted" |
|
|
|
else |
|
|
|
echo $response |
|
|
|
echo "error with server" |
|
|
|
echo "Error with server" |
|
|
|
fi |
|
|
|
else |
|
|
|
echo "submission aborted" |
|
|
|
echo "Submission aborted" |
|
|
|
fi |
|
|
|
else |
|
|
|
echo "error in vm execution" |
|
|
|
echo "Error in vm execution" |
|
|
|
fi |