#!/bin/bash if [ $# -lt 1 ]; then echo "Missing json filename" exit 1 fi if [ $# -lt 2 ]; then 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" else echo $response echo "Error with server" fi else echo "Submission aborted" fi else echo "Error in vm execution" fi