Created
August 30, 2023 09:13
-
-
Save jared-hughes/4e94499d96680dce7c11c80405c0f8d1 to your computer and use it in GitHub Desktop.
Golf a TeX solution with tex-autogolfer (https://github.com/jared-hughes/tex-autogolfer), then submit to code.golf with golfc (https://github.com/jared-hughes/golfc). Requires those two dependencies, and a specific directory structure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
if [[ $# -lt 1 ]]; then | |
echo "Usage: submit-tex.sh [hole] [options]" | |
echo "Example: ./submit-tex.sh ./src/fizz-buzz.tex" | |
echo "Requires directory setup where all .tex files are in ./src." | |
exit 1 | |
fi | |
hole="$1"; shift | |
hole="${hole#*src/}" | |
hole="${hole%.tex}" | |
in="src/$hole.tex" | |
out="zout/$hole.tex" | |
~/tex-autogolfer/dist/cli.js "$@" "$in" > "$out" | |
printf "Bytes: %d [golfed from %d]\n" "$(wc --bytes < "$out")" "$(wc --bytes < "$in")" | |
golfc submit -i "$out" -l tex -h "$hole" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment