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.

#!/bin/bash
META="text/gemini; charset=utf-8"

input="${QUERY_STRING//[^abcde12345CFS+\-><]/}"
if [ -n "$input" ]; then
    new_ptn="${PATH_INFO//[^abcde12345CFS.+\-LR]/}"
    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;
    done
    attempt_ptn="$new_ptn$input."
    output=$(geminict ${attempt_ptn@Q})
    if [ "$?" == "0" ]; then
	ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
	new_ptn="$attempt_ptn$ct1986."
    fi;
    new_ptn=${new_ptn//>/R}; new_ptn=${new_ptn// gemini://l-3.space/tak/$new_ptn/ Enter ply"
    echo 'Note: all input is stripped to match only [abcde12345CFS+-<>].'
else
    printf "10 Enter ply:\r\n"
fi;

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

--

⁰ hello@l-3.space

Proxy Information
Original URL
gemini://l-3.space/log-211006-1.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
149.372385 milliseconds
Gemini-to-HTML Time
0.264618 milliseconds

This content has been proxied by September (ba2dc).