My favorite part is the "shuffles in" part -- I'm not familiar with the "real" array shuffling algorithms, but this is random enough for me.use Person; use Bar qw/:smoky/; my $piano_man = Person->new( name => 'Billy Joel' ); ### it's 9:00 on a Saturday. a regular crowd shuffles in my @crowd = (); if ( (localtime time)[2] == 21 and (localtime time)[6] == 6) ) { splice(@crowd, rand(@crowd), 0, Person->new) for (1 .. $regular); } ### there's an old man sitting next to me, making love to his tonic an +d gin. my $mypos = $piano_man->position_in(@crowd); my $old_man = Person->new( gender => 'M', position => 'sitting', age = +> 70, figurative_sexual_partners => [ $tonic, $gi +n ] ); splice(@crowd, $mypos+1, 0, $old_man); # .. insert the rest of verse one here ... my @us = @crowd[ 0 .. ($mypos-1), ($mypos+1) .. $#crowd ]; ### sing us a song, you're the piano man. sing us a song tonight ((localtime time)[2] > 18) and $piano_man->sing( $songs[rand(@songs)], @us ); ### well, we're all in the mood for a melody and you've got us feeling + alright. my $alright = ($bad + $good)/2; for (@us) { $_->set_mood_flag(1 << MELODY); $_->feel_emotion($alright); }
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Piano Man
by nothingmuch (Priest) on Oct 22, 2002 at 11:56 UTC | |
|
Re: Piano Man
by ibanix (Hermit) on Nov 23, 2002 at 13:23 UTC |