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

Re: Favorite Star Wars film:

by webfiend (Vicar)
on May 28, 2002 at 05:29 UTC ( #169707=note: print w/replies, xml ) Need Help??

in reply to Favorite Star Wars film:

I had to think about this one. It took so much work to think about it that I came up with a script to help me figure it out.

my $EHH = 0; # A constant indicating indifference. my $best_time = 0; my $favorite = ""; my @episodes = what_were_the_names_again(); foreach my $movie (@episodes) { next unless (released($movie)); %scenes = watch($movie); my $opinion = $scenes{"fun"} + $scenes{"cool"} - $scenes{"awkward"} - $scenes{"midochlorians mentioned"}; if ($opinion > $best_time) { $favorite = $movie; $best_time = $opinion; } # Present a quick recap of how I felt about this episode. if ($opinion > $EHH) { print "$movie was pretty good.\n"; } elsif ($opinion == $EHH) { print "$movie was okay.\n"; } else { print "$movie kinda sucked.\n"; } } print "My favorite would have to be $favorite.\n";

I'd have to say Episode 4 was my favorite according to this logic, but a more refined approach to calculating $opinion would be in order. For example, this calculation completely ignores appearances by my favorite cranky green muppet (besides Kermit).

Oh, man. I worry about myself sometimes.

Update: Updated the commentary to match the code. Whoops.

"All you need is ignorance and confidence; then success is sure."-- Mark Twain

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://169707]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2018-02-25 14:12 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (312 votes). Check out past polls.