aboutsummaryrefslogtreecommitdiff
path: root/games/squ.awk
diff options
context:
space:
mode:
Diffstat (limited to 'games/squ.awk')
-rw-r--r--games/squ.awk7
1 files changed, 7 insertions, 0 deletions
diff --git a/games/squ.awk b/games/squ.awk
new file mode 100644
index 00000000..be72a3b6
--- /dev/null
+++ b/games/squ.awk
@@ -0,0 +1,7 @@
+# Make a reduced Latin square out of each line of input
+l = length($0) {
+ str = toupper($0)
+ for (j = 0; j < l; j++)
+ for (k = 0; k < l; k++)
+ printf (k < l - 1) ? "%s " : "%s\n", substr(str, (k + j) % l + 1, 1)
+}