diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | README.markdown | 1 | ||||
-rw-r--r-- | games/squ.awk | 10 | ||||
-rw-r--r-- | man/man6/squ.6df | 28 |
5 files changed, 41 insertions, 0 deletions
@@ -124,6 +124,7 @@ games/drakon games/kvlt games/rndn games/rot13 +games/squ games/strik games/xyzzy games/zs @@ -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> |