aboutsummaryrefslogtreecommitdiff
path: root/games/drakon.awk
diff options
context:
space:
mode:
Diffstat (limited to 'games/drakon.awk')
-rw-r--r--games/drakon.awk14
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
}