Skip to content

Instantly share code, notes, and snippets.

@petdance
Created April 11, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petdance/9d75dd5578b1e1cda076d81dc6bd4ef8 to your computer and use it in GitHub Desktop.
Save petdance/9d75dd5578b1e1cda076d81dc6bd4ef8 to your computer and use it in GitHub Desktop.
Most money you can win on Jeopardy
#!/usr/bin/perl
use warnings;
use strict;
use 5.010;
use List::Util qw( sum );
my $score = 0;
$score = run( $score, 200, 400, 600, 800, 1000 ) for 1..5;
$score = run( $score, 400, 600, 800, 1000 ) for 6..6;
$score = dd( $score );
say "End of J, score = $score";
$score = run( $score, 400, 800, 1200, 1600, 2000 ) for 1..4;
$score = run( $score, 800, 1200, 1600, 2000 ) for 5..6;
$score = dd( $score ) for 1..2;
say "End of DJ, score = $score";
$score *= 2;
say "End of FJ, score = $score";
sub run {
my $score = shift;
return $score + sum ( @_ );
}
sub dd {
my $score = shift;
return $score * 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment