Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Wacky Happy Fun Genuine Coin Flipping Software OK!

by PsionicMan (Beadle)
on Jun 05, 2001 at 09:18 UTC ( [id://85701]=note: print w/replies, xml ) Need Help??


in reply to Re: Wacky Happy Fun Genuine Coin Flipping Software OK!
in thread Wacky Happy Fun Genuine Coin Flipping Software OK!

My correction is in the original now. Thanks for the heads up on that, merlyn.

And would anyone care to elaborate on how I might do what merlyn suggests? Would that be changing up the unpack params, or what?

--Psi
print(pack("h*","e4f64702566756e60236c6f637560247f602265696e676021602075627c602861636b65627e2")."\n");

Replies are listed 'Best First'.
Re: Re: Re: Wacky Happy Fun Genuine Coin Flipping Software OK!
by Arguile (Hermit) on Jun 05, 2001 at 10:53 UTC
    print "The coin flew out of sight, sorry. No answer, and you're out $0 +.25.\n";

    Seeing as you're using double quotes, won't the $0 be interpolated? I doubt this is what you intended, so you might want to consider escaping the $ or using single quotes and concatinating the newline onto the string.

    Ohh and in reply to "Well, this should really go under "Idiotic Uses for Perl that are entirely Overkill", but alas, there is no such section..." there is in fact such a section. ;)
      Ooops. Fixed it up there. What can I say... it was late last night when I did all that. :)

      And I considered putting it in Obfuscated Code, but, while it may be obfuscated in spirit, it's really just straightforeward perl. No trickery or anything.

      --Psi
      print(pack("h*","e4f64702566756e60236c6f637560247f602265696e676021602075627c602861636b65627e2")."\n");

Re: Re: Re: Wacky Happy Fun Genuine Coin Flipping Software OK!
by Cybercosis (Monk) on Jun 05, 2001 at 10:53 UTC
    Well... (completely untested)
    use HotBits; my $x = new HotBits::; my $n1 = $x->request (1); ($n1 & 1) ? print "Heads\n" : print "Tails\n";
    Okay, I lied and just tested it, and it's giving me all heads. Maybe i'm just being lucky =-) (it's entirely more likely that I'm just being buggy)

    ~Cybercosis nemo accipere quod non merere

Re: Re: Re: Wacky Happy Fun Genuine Coin Flipping Software OK!
by John M. Dlugosz (Monsignor) on Jun 06, 2001 at 00:17 UTC
    Changing the unpack param to b* gives you a bit string. Unpack won't give you a list directly.

    my @array= map { qw(heads tails)[$_] } (split (//, unpack ("b*", $bits +))); print "@array";
    —John

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://85701]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found