aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-05-01 21:47:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-05-01 21:47:15 +1200
commitc31338baca39b5a545ce307327fea2fefb9ed99e (patch)
tree85a2082f310699df3575c453ecfe71e5a95f3024
parentUpdate documentation URLs (diff)
downloaddotfiles-c31338baca39b5a545ce307327fea2fefb9ed99e.tar.gz
dotfiles-c31338baca39b5a545ce307327fea2fefb9ed99e.zip
Add squ(6df)
-rw-r--r--.gitignore1
-rw-r--r--Makefile1
-rw-r--r--README.markdown1
-rw-r--r--games/squ.awk10
-rw-r--r--man/man6/squ.6df28
5 files changed, 41 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index bb4e5163..ea3ec93a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -124,6 +124,7 @@ games/drakon
games/kvlt
games/rndn
games/rot13
+games/squ
games/strik
games/xyzzy
games/zs
diff --git a/Makefile b/Makefile
index 1f06814c..9d987150 100644
--- a/Makefile
+++ b/Makefile
@@ -201,6 +201,7 @@ GAMES = games/aaf \
games/kvlt \
games/rndn \
games/rot13 \
+ games/squ \
games/strik \
games/xyzzy \
games/zs
diff --git a/README.markdown b/README.markdown
index 94659faf..2d8003c6 100644
--- a/README.markdown
+++ b/README.markdown
@@ -555,6 +555,7 @@ There's some silly stuff in `install-games`:
* `acq(6df)` allows you to interrogate AC, the interplanetary computer.
* `aesth(6df)` converts English letters to their fullwidth CJK analogues, for
AESTHETIC PURPOSES.
+* `squ(6df)` makes a word square out of each line of input.
* `kvlt(6df)` translates input to emulate a style of typing unique to black
metal communities on the internet.
* `rndn(6df)` implements an esoteric random number generation algorithm.
diff --git a/games/squ.awk b/games/squ.awk
new file mode 100644
index 00000000..0d8f9210
--- /dev/null
+++ b/games/squ.awk
@@ -0,0 +1,10 @@
+# Make a square out of each line of input
+{
+ str = toupper($0)
+ len = length(str)
+ for (i = 1; i <= len; i++)
+ let[i - 1] = substr(str, i, 1)
+ for (j in let)
+ for (k in let)
+ printf (k < len - 1) ? "%s " : "%s\n", let[(k + j) % len]
+}
diff --git a/man/man6/squ.6df b/man/man6/squ.6df
new file mode 100644
index 00000000..c3ae177e
--- /dev/null
+++ b/man/man6/squ.6df
@@ -0,0 +1,28 @@
+.TH SQU 6df "May 2017" "Manual page for squ"
+.SH NAME
+.B squ
+\- print a word square out of each line of input
+.SH USAGE
+.B squ
+.br
+london
+.br
+^D
+.br
+L O N D O N
+.br
+O N D O N L
+.br
+N D O N L O
+.br
+D O N L O N
+.br
+O N L O N D
+.br
+N L O N D O
+.SH DESCRIPTION
+.B squ
+makes a kind of letter square out of the characters on each line of input,
+uppercasing them first.
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>