Created
April 11, 2019 15:08
-
-
Save petdance/9d75dd5578b1e1cda076d81dc6bd4ef8 to your computer and use it in GitHub Desktop.
Most money you can win on Jeopardy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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