Hi all,
This is the first JAPH I've ever written. It's simple, but (AFAIK) has an original idea.
use Time::HiRes 'usleep';++$|;$s='rekcah lreP rehtona tsuJ';@v= (65..90,97..122,32);do{do{print$_=sprintf'%c',$v[rand@v];usleep 2000;print"\b"}while$_ ne substr$s,-1;chop$s;print}while$s
Basically what it does is it loops randomly through A-Za-z and a space until it finds the correct character for that spot and then moves on to the next character. I added a small delay too so one can see it shuffling through the characters instead of the boring, ordinary way of instantaneous appearance of the whole string. ;)
Update: An indented and commented version with whitespaces
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Brute-force JAPH
by Lawliet (Curate) on Jan 27, 2009 at 23:26 UTC | |
by jh- (Scribe) on Jan 27, 2009 at 23:47 UTC | |
by Lawliet (Curate) on Jan 27, 2009 at 23:52 UTC | |
by jh- (Scribe) on Jan 28, 2009 at 05:12 UTC | |
by ambrus (Abbot) on Jan 28, 2009 at 12:11 UTC |