Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Cumulative Guessing JAPH

by kschwab (Vicar)
on Jan 07, 2021 at 00:31 UTC ( #11126487=obfuscated: print w/replies, xml ) Need Help??

May take a while on an old PC.

Also see Progressive JAPH by Athanasius.

$|++,$a=$b='Ktru!`onuids!Qdsm!i`bjds-',$==length$b,$b^="\01"x$=, @_=map{chr}(32..126);while($=>(($a^$b)=~tr/\x0//)){for(sort{rand >.5}1..$=){substr($a,$_-$|,1)ne(substr($b,$_-1,1))and substr($a, $_-$|,1)=@_[rand@_],print"\r",$a;select($,,$,,$,,.001)}};print$/

Replies are listed 'Best First'.
Re: Cumulative Guessing JAPH
by choroba (Archbishop) on Jan 07, 2021 at 09:09 UTC
    Cool! Also check Pumping JAPH :-)
    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      That's really cool. Now I'm trapped making some variant of it that's worth posting!

Re: Cumulative Guessing JAPH
by jszinger (Scribe) on Jan 07, 2021 at 18:18 UTC

    This is really fun to watch and was fun to decipher.

    Why would this take a long time on an old PC?

    The number of iterations is independent of CPU speed, and each iteration has a deliberate delay. In my testing, even on my slowest PC, CPU time is less than 10% of wall clock time, and the delay code itself consumes over 90% of the CPU time.

      Why would this take a long time on an old PC?

      Yes, it's wouldn't. Just encouraging people to wait it out, it can run more than 10 seconds or so.

Re: Cumulative Guessing JAPH
by stevieb (Canon) on Jan 07, 2021 at 18:49 UTC

    This is superbly awesome!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://11126487]
Approved by kcott
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2021-09-17 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?