Automatically generated from the Gemini capsule gemini://

Time-stamp: <2021-10-06 22h28 UTC>

Play Tak against a bot over Gemini!

The title says it all! I had all the pieces lying about and so finally decided to put them together into a shoddy CGI script which calls my not-so-great bot on a game state. I'm excited to reveal what must surely be a Gemini first (only because the Tak player base is yet growing):

The Tak portal

At present i've attempted to limit the server to running 10 instances of the bot at once, but i'm not sure that that will work correctly. I'm also not sure i've defeated shell escapes here---please let me know⁰ how to improve on this! Here's the entire CGI script, all 27 lines of it.

META="text/gemini; charset=utf-8"

if [ -n "$input" ]; then
    new_ptn=$(echo $new_ptn | tr 'LR' '<>')
    printf '20 %s\r\n' "$META"
    printf '```\n'
    while [ "$(pgrep geminict | wc -l)" > "10" ]; do
	sleep 0.5s;
    output=$(geminict ${attempt_ptn@Q})
    if [ "$?" == "0" ]; then
	ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
    new_ptn=${new_ptn//>/R}; new_ptn=${new_ptn//</L};
    printf '%s\n' "$output"
    printf '```\n'
    echo 'Please be patient, ct1986 is a slow bot and no more than 10 instances are allowed concurrently on the server.'
    echo "=> gemini://$new_ptn/ Enter ply"
    echo 'Note: all input is stripped to match only [abcde12345CFS+-<>].'
    printf "10 Enter ply:\r\n"

Finally, while my capsule does compile to the web, this service is a Gemini exclusive :)