#!/usr/bin/perl use warnings; use strict; my $USAGE =<= 1 and @ARGV <= 2; my $xp = shift; my $level = 0; push @LEVEL, [ pop, 42, 'the one and only vroom' ] if @ARGV; my $day = 0; do { $day++; # Anyone remember One Day at a Time? # What level are we today? while ($LEVEL[ $level + 1 ] and $xp >= $LEVEL[ $level + 1 ]->[ XP ]) { $level++; printf "Day %5d You are %s.\n", $day, $LEVEL[ $level ]->[ DESC ]; } # %25 chance of 2xp for showing up. int rand( 4 ) or $xp += 2; # %25 chance of 1xp for every vote. int rand( 4 ) or $xp++ for 1 .. $LEVEL[ $level ]->[ VOTES ]; # 1/6 * votes * 1xp for pre-friars. $xp += int ( $LEVEL[ $level ]->[ VOTES ] / 6 ) if $level < 4; } until ( $level == $#LEVEL );