diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-10-19 10:51:31 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-10-19 10:51:31 +1300 |
commit | ed10c4a72a45e8164779bc24a9e550ff1e07af55 (patch) | |
tree | d42ae4a34bae4a4cf80a90f2957db2807a8f085d /games | |
parent | Remove executable bit from rot13.sed source (diff) | |
download | dotfiles-ed10c4a72a45e8164779bc24a9e550ff1e07af55.tar.gz dotfiles-ed10c4a72a45e8164779bc24a9e550ff1e07af55.zip |
Improve accuracy of drakon(6df)
On closer inspection, it looks like an alternating upper-lower pattern
for letter characters
Diffstat (limited to 'games')
-rw-r--r-- | games/drakon.awk | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/games/drakon.awk b/games/drakon.awk index 65cf748e..e960a6c0 100644 --- a/games/drakon.awk +++ b/games/drakon.awk @@ -2,13 +2,17 @@ # <http://www.adomgb.info/adomgb-4.html> { s = "" + u = 0 for (i = 1; i <= length($0); i++) { c = substr($0, i, 1) - if (i % 2) { - c = tolower(c) - } - else { - c = toupper(c) + if (c ~ /[a-zA-Z]/) { + if (u) { + c = toupper(c) + } + else { + c = tolower(c) + } + u = !u } s = s c } |