#!/usr/bin/perl use warnings; use strict; use Lingua::EN::Inflect 'A'; my ($day, $level, $xp); $level = {xp => 0, votes => 0, title => "Initiate", next => {xp => 20, votes => 2, title => "Novice", next => {xp => 50, votes => 4, title => "Acolyte", next => {xp => 90, votes => 6, title => "Sexton", next => {xp => 150, votes => 8, title => "Beadle", next => {xp => 250, votes => 10, title => "Scribe", next => {xp => 400, votes => 12, title => "Monk", next => {xp => 600, votes => 14, title => "Pilgrim", next => {xp => 900, votes => 16, title => "Friar", next => {xp => 1300, votes => 18, title => "Hermit", next => {xp => 1800, votes => 20, title => "Chaplain", next => {xp => 2400, votes => 22, title => "Deacon", next => {xp => 3000, votes => 24, title => "Curate", next => {xp => 4000, votes => 26, title => "Priest", next => {xp => 5400, votes => 28, title => "Vicar", next => {xp => 7000, votes => 30, title => "Parson", next => {xp => 9000, votes => 32, title => "Prior", next => {xp => 12000, votes => 34, title => "Monsignor", next => {xp => 16000, votes => 36, title => "Abbot", next => {xp => 22000, votes => 38, title => "Canon", next => {xp => 30000, votes => 40, title => "Chancellor", next => {xp => 40000, votes => 42, title => "Bishop", next => {xp => 50000, votes => 44, title => "Archbishop", next => {xp => 60000, votes => 46, title => "Cardinal", next => {xp => 70000, votes => 48, title => "Sage", next => {xp => 80000, votes => 50, title => "Saint", next => {xp => 90000, votes => 52, title => "Apostle", next => {xp => 100000, votes => 54, title => "Pope"}}}}}}}}}}}}}}}}}}}}}}}}}}}}; $| = 1; print "Enter your current xp: "; chomp($xp = ); die "Doesn't look quite like an xp to me\n" if $xp ne do { no warnings 'numeric'; 0+$xp }; $day = 0; while ($level->{next}) { # bonus for casting all votes (through level 5) $xp += int($level->{votes}/6) if $day > 0 && $level->{votes} < 10; ($level = $level->{next}) and print("Day $day: you are ", A($level->{title}), "\n") while $level->{next} && $xp >= $level->{next}{xp}; ++$day; # 25% chance for each vote cast (rand(4) < 1) and ++$xp for 1..$level->{votes}; # 25% chance for 2 xp for logging in (rand(4) < 1) and $xp += 2; }