Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Perl Lazy Surfing!

by Sigmund (Pilgrim)
on Sep 10, 2001 at 17:56 UTC ( [id://111454]=CUFP: print w/replies, xml ) Need Help??

Well, i admit it: it's a really strange script...
Today i was on the beach. Now that September has come, surfers rule the beach 'cos this weather makes surf possible here in my hometown.
I usually go to the beach with a friend of mine, and we spend hours talkin' about computers, programming and unix systems, glancing at girls and wondering why should they be interested in such a geek beings...
So, there was a longboard contest there, and we were kidding those strained surfers trying to ride two-feet-tall waves and spending a whole lot of muscles in vain; what a poor task was theirs...
Suddenly Icchio a.k.a. Matteo (my friend) had a silly great idea: "Why don't you code a Perl script which surfs for you?" <KIDDING ME>

This is what i did: i took my Camel Book out of my sack (yes, i DO carry with me on the beach the Camel Book)(really) and coded this script that, as usual, is warning safe and strict compliant!
You can use it when you gotta choose something by chance: each guy runs the script and who scores best decides!
Enjoy!

#!/usr/bin/perl -w use strict; my ($waves, $board, $ride, $score); $board = int (rand 5); print "Your board is pretty good! Go ride, Master!\n\n" if $board <= 1; print "Poor Lamer...Where d'ya wanna go with that board?\n\n" if $board >= 4; print "Got a good old standard longboard! Enjoy!\n\n" if $board == 2 || $board == 3; sleep 1; $waves = 5; $score = 0; while ($waves != 0) { $waves = int (rand 9); if ($waves == 0) { print "No more waves, the tide has gone...\n"; print "Today's score is: ", $score, "\n"; last } $ride = ($waves - $board); $score++, $score++, print "Damn good ride!\n" if $ride >= 3; $score++, print "Fine ride!\n" if $ride < 3 && $ride >= (-2); print "Loser!\n" if $ride < (-2); if ($ride <= (-4)) { print "You're gonna break your neck!\n"; ++$board; } sleep 1; }
SiG

perl -le 's ssSss.s sSsSiss.s s$sSss.ss .$s\107ss.print'


Replies are listed 'Best First'.
Re: Perl Lazy Surfing!
by mexnix (Pilgrim) on Sep 10, 2001 at 18:37 UTC
    Now this is my kind of geek! If I had a laptop, I'd take it and all my books down to the beach and code all weekend! I come with code like this all the time. It just never gets to my computer. Whenever my friends and I are just sitting around and we're talking about doing stuff (actions mostly) they, knowing the perl geek I am, say "Why don't you just write a perl program for it?" I think it's a game to them to see how much code I can come up with on the fly. :)

    __________________________________________________

    s mmgfbs nf, nfyojy m,tr yb-zya-zy,s zfzphz,print;
    - thanks japhy :)

    mexnix.perlmonk.org

      A year or so ago walking along the beach I saw a kid who was overweight, alabaster white, wore glasses, etc. quite unlike the "usual" beach crowd. However, he had the most spectacular sandcastle =complex= on the beach. Ah, baby nerds... our kind will indeed continue into the next generation. I had to offer him words of encouragement.

      However, telling that story inspired me. I went back to the beach with some tools and did a proof-of-concept of a flying buttress in a sand castle.

      No computers on the beach, though. The sand is just too much for it. Though a pocket-PC in a ziplock bag might be in my future...

      —John

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-09-11 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (13 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.