if [ "$1" = "" ]; then
    read
fi
if [ "$2" = "" ]; then
    read
fi
if [ ! -f "$1" ]; then
    read
fi
echo "Running validator"
wine files/towin.exe "$1" | wine files/pawns_validator.exe
if [ "$?" -ne "0" ]; then
    read
fi
cp $1 pawns.in
echo "Running solution pawns_ge.cpp"
wine solutions/pawns_ge.exe
if [ "$?" -ne "0" ]; then
    echo "Solution returned non-zero exit code"
    read
fi
rm -f pawns.in
if [ ! -f "pawns.out" ]; then
    echo "Solution didn't produced output [pawns.out]"
    read
fi
mv "pawns.out" "$2"
echo "Running checker"
wine check.exe $1 $2 $2
if [ "$?" -ne "0" ]; then
    echo "Checker returned non-zero exit code"
    read
fi
