### # # this sub was originally separated out so i could try averages vs. # weighting the averages toward the most recent game. # i chose to weight them because it won't allow any one game to be too hard. sub game { my $historic = shift; my $game = score; return (($historic+$game)/2); } ### the meta game itself. # # basically, each round you are trying to keep your (weighted) average score above # the target (set at the start of the metagame, and incremented with each game). # $spares is the number of games you can "do over"; # pretend that didn't happen and play that game again. sub meta { my ($historic, $target, $spares) = @_; my $games = 0; my $archive = 0; do { { $archive = $historic; ($historic) = game($historic); if ($historic < $target and $spares) { --$spares; $historic = $archive; redo; } } } while (++$games and $historic > $target and ++$target); return ($archive, --$target, $games); }