summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <>2021-10-05 23:06:17 -0400
committertslil clingman <>2021-10-05 23:06:17 -0400
commit0f652b2d99855c8270aa65d8772f7e340f96f73d (patch)
tree55924795772d1d353968f3be99c7ee5b7430d8cf
parent7c4657c41c603307a7d6cf1293294f34eceea24f (diff)
Reveal tak to the world!
-rwxr-xr-xct198617
-rw-r--r--index-log.gmi1
-rw-r--r--index.gmi1
-rw-r--r--log-211004-1.gmi10
-rw-r--r--log-211006-1.gmi42
-rwxr-xr-xtak24
-rw-r--r--tak.gmi30
7 files changed, 103 insertions, 22 deletions
diff --git a/ct1986 b/ct1986
deleted file mode 100755
index 047999b..0000000
--- a/ct1986
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-META="text/gemini; charset=utf-8"
-
-if [ -n "${QUERY_STRING}" ]; then
- new_ptn="${PATH_INFO//\//}${QUERY_STRING}."
- printf '20 %s\r\n' "$META"
- printf '```\n'
- while [ "$(pgrep geminict | wc -l)" > "10" ]; do
- sleep 0.25s;
- done
- geminict "$new_ptn"
- printf '```\n'
- echo 'Please be patient, ct1986 is a slow bot and no more than 10 instances are allowed concurrently on the server.'
- printf "=> gemini://l-3.space/ct1986/$new_ptn/ Enter next move"
-else
- printf "10 Enter starting move:\r\n"
-fi;
diff --git a/index-log.gmi b/index-log.gmi
index b99b748..338ca9f 100644
--- a/index-log.gmi
+++ b/index-log.gmi
@@ -2,6 +2,7 @@
Shorter thoughts and articles.
+=> gemini://l-3.space/log-211006-1.gmi 2021-10-06 - Play Tak against a bot over Gemini!
=> gemini://l-3.space/log-211004-1.gmi 2021-10-04 - Switched to gmnisrv
=> gemini://l-3.space/log-210421-1.gmi 2021-04-21 - l-3.space is now automatically compiled to the web
=> gemini://l-3.space/log-210415-1.gmi 2021-04-15 - Modding my Thinkpad x230
diff --git a/index.gmi b/index.gmi
index e2bf4db..7e77b21 100644
--- a/index.gmi
+++ b/index.gmi
@@ -22,6 +22,7 @@ Contact: hello@l-3.space
## Recent posts
+=> gemini://l-3.space/log-211006-1.gmi 2021-10-06 - Play Tak against a bot over Gemini!
=> gemini://l-3.space/log-211004-1.gmi 2021-10-04 - Switched to gmnisrv
=> gemini://l-3.space/log-210421-1.gmi 2021-04-21 - l-3.space is now automatically compiled to the web
=> gemini://l-3.space/log-210415-1.gmi 2021-04-15 - Modding my Thinkpad x230
diff --git a/log-211004-1.gmi b/log-211004-1.gmi
index 1181b92..f9086dc 100644
--- a/log-211004-1.gmi
+++ b/log-211004-1.gmi
@@ -7,3 +7,13 @@ At some point between April and September 2021 my old SSL certs expired. I took
In the end i went with gmnisrv, a small C implementation backed by OpenSSL. Among its draws is the fact that it automatically generates (and presumably maintains?) certificates.
=> https://sr.ht/~sircmpwn/gmnisrv/ gmnisrv
+
+## Later ...
+
+A kind sole not only read this, but was generous enough to reach out to help me learn about TOFU and Gemini practices. They directed me to the article
+
+=> gemini://warmedal.se/~bjorn/posts/your-gemini-browser-and-server-are-probably-doing-certificates-wrong.gmi
+
+and i learnt some things. Fortunately gmnisrv appears to have set something like an 80 year expiration on these new certs, so apparently its defaults are sane.
+
+To the helpful individual: if you'd like to be credited for point this out, i'd be happy to do so! Thanks for reading and educating!
diff --git a/log-211006-1.gmi b/log-211006-1.gmi
new file mode 100644
index 0000000..5849d6f
--- /dev/null
+++ b/log-211006-1.gmi
@@ -0,0 +1,42 @@
+Time-stamp: <2021-10-06 02h58 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):
+
+=> gemini://l-3.space/tak.gmi 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 24 lines of it.
+
+```CGI script for Tak
+#!/bin/bash
+META="text/gemini; charset=utf-8"
+
+input="${QUERY_STRING//[^abcde12345CFW]/}"
+if [ -n "$input" ]; then
+ new_ptn="${PATH_INFO//[^abcde12345CFW.]/}"
+ printf '20 %s\r\n' "$META"
+ printf '```\n'
+ while [ "$(pgrep geminict | wc -l)" > "10" ]; do
+ sleep 0.25s;
+ done
+ output="$(geminict "$new_ptn$input.")"
+ if [ "$?" == "0" ]; then
+ ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
+ new_ptn="$new_ptn$input.$ct1986."
+ fi;
+ 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://l-3.space/tak/$new_ptn/ Enter ply"
+ echo 'Note: all input is stripped to match only [abcde12345CFW].'
+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
diff --git a/tak b/tak
new file mode 100755
index 0000000..62ff252
--- /dev/null
+++ b/tak
@@ -0,0 +1,24 @@
+#!/bin/bash
+META="text/gemini; charset=utf-8"
+
+input="${QUERY_STRING//[^abcde12345CFW]/}"
+if [ -n "$input" ]; then
+ new_ptn="${PATH_INFO//[^abcde12345CFW.]/}"
+ printf '20 %s\r\n' "$META"
+ printf '```\n'
+ while [ "$(pgrep geminict | wc -l)" > "10" ]; do
+ sleep 0.25s;
+ done
+ output="$(geminict "$new_ptn$input.")"
+ if [ "$?" == "0" ]; then
+ ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
+ new_ptn="$new_ptn$input.$ct1986."
+ fi;
+ 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://l-3.space/tak/$new_ptn/ Enter ply"
+ echo 'Note: all input is stripped to match only [abcde12345CFW].'
+else
+ printf "10 Enter ply:\r\n"
+fi;
diff --git a/tak.gmi b/tak.gmi
index 030d1a1..059f425 100644
--- a/tak.gmi
+++ b/tak.gmi
@@ -1,9 +1,6 @@
# Tak
-Welcome to Gemini Tak. Here you can play against my rather slow, rather unskilled Tak bot on the 5x5 grid size. The game board, state, and log are displayed each turn. To make a play, enter your desired action in PTN.
-
-=> http://cheapass.com/wp-content/uploads/2016/07/Tak-Beta-Rules.pdf Tak rules
-=> https://ustak.org/portable-tak-notation/ PTN explained
+Welcome to Gemini Tak. Here you can play against my rather slow, rather unskilled Tak bot on the 5x5 grid size. The game board, state, and log are displayed each turn.
The interface presently makes use of the following unicode characters, listed as ``(black) & (white)'':
@@ -13,4 +10,27 @@ The interface presently makes use of the following unicode characters, listed as
* ▭ & ▬ represent in-stack flats
* ▿ & ▾ represent in-stack flats that are below the carrying capacity
-=> gemini://l-3.space/ct1986/ Begin!
+=> gemini://l-3.space/tak/ Play Tak!
+
+## About Tak
+
+The rules of Tak may be found here
+
+=> http://cheapass.com/wp-content/uploads/2016/07/Tak-Beta-Rules.pdf Tak rules
+
+and the plies are entered as PTN
+
+=> https://ustak.org/portable-tak-notation/ PTN explained
+
+## About the bot
+
+A somewhat simple negamax+transposition tables backed by a small (1986 weight) convolutional neural network evaluation function, and some extremely naive move ordering. Unfortunately i have yet to implement any sort of temporal difference learning, so the network has been trained on predicting winning probabilities instead of being trained to be a leaf evaluator.
+
+Bot and library source code:
+
+=> https://git.sr.ht/~tslil/ct
+
+
+## Let me know!
+
+Please send your feedback to hello@l-3.space, i'd love to know whether people made use of this. I'm especially interested in potential improvements, and plugging the doubtlessly many security holes this particular CGI script has opened up!