diff options
Diffstat (limited to 'games')
-rw-r--r-- | games/pks.awk | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/games/pks.awk b/games/pks.awk index c490e8dc..c7ff320d 100644 --- a/games/pks.awk +++ b/games/pks.awk @@ -13,12 +13,13 @@ BEGIN { } # Seed the random number generator - srand() + "rnds 2>/dev/null" | getline seed + srand(seed) } # Iterate over the lines, randomly assigning the first field of each one with a # decreasing probability; this method -rand() * NR < 1 { wr = $1 } +$1 ~ /[[:alpha:]]/ && rand() * ++n < 1 { wr = $1 } # Ha, ha, ha! Incompetent! END { @@ -27,11 +28,10 @@ END { if (!NR) exit 1 - # Strip trailing possessives - sub(/'s*$/, "", wr) + # Strip trailing possessives and punctuation + sub(/[^[:alpha:]]+s*$/, "", wr) # Two or three "has"? Important decisions here folks - srand() hr = int(rand()*2+1) for (ha = "Ha"; hi < hr; hi++) ha = ha ", ha" |