Show up every day, punch in your votes, and you too, yes you, can be a saint.
Update: See Re: Sainthood via Seniority Simulation for a new version for the expanded level system.
#!/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 => 5, title => "novice", next => {xp => 50, votes => 8, title => "acolyte", next => {xp => 100, votes => 12, title => "scribe", next => {xp => 200, votes => 16, title => "monk", next => {xp => 500, votes => 20, title => "friar", next => {xp => 1000, votes => 25, title => "abbot", next => {xp => 1600, votes => 30, title => "bishop", next => {xp => 2300, votes => 35, title => "pontiff", next => {xp => 3000, votes => 40, title => "saint"}}}}}}}}}}; $| = 1; print "Enter your current xp: "; chomp($xp = <STDIN>); 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} < 16; + # (update:corrected from <= 16) ($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; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sainthood via Seniority Simulation
by perrin (Chancellor) on Nov 05, 2003 at 04:24 UTC | |
by Abigail-II (Bishop) on Nov 05, 2003 at 09:16 UTC | |
by theorbtwo (Prior) on Nov 05, 2003 at 11:02 UTC | |
by Abigail-II (Bishop) on Nov 05, 2003 at 11:30 UTC | |
by jonadab (Parson) on Nov 05, 2003 at 14:15 UTC | |
by chaoticset (Chaplain) on Sep 11, 2004 at 13:06 UTC | |
by apotheon (Deacon) on Oct 23, 2004 at 09:59 UTC | |
by chaoticset (Chaplain) on Oct 24, 2004 at 22:28 UTC | |
| |
| |
Re: Sainthood via Seniority Simulation
by pg (Canon) on Nov 05, 2003 at 06:04 UTC | |
by ysth (Canon) on Nov 05, 2003 at 06:20 UTC | |
by ysth (Canon) on Nov 05, 2003 at 19:18 UTC | |
Re: Sainthood via Seniority Simulation
by sauoq (Abbot) on Nov 05, 2003 at 10:56 UTC | |
Re: Sainthood via Seniority Simulation
by delirium (Chaplain) on Nov 05, 2003 at 12:59 UTC | |
by Anonymous Monk on Dec 17, 2003 at 21:25 UTC | |
Re: Sainthood via Seniority Simulation
by ysth (Canon) on Nov 05, 2003 at 05:34 UTC | |
by jonadab (Parson) on Nov 05, 2003 at 14:02 UTC | |
by ambrus (Abbot) on Nov 11, 2003 at 11:04 UTC | |
Re: Sainthood via Seniority Simulation
by zentara (Archbishop) on Nov 05, 2003 at 17:59 UTC | |
Re: Sainthood via Seniority Simulation
by planetscape (Chancellor) on Nov 11, 2005 at 01:53 UTC | |
by ysth (Canon) on Nov 11, 2005 at 05:01 UTC | |
by planetscape (Chancellor) on Nov 11, 2005 at 21:49 UTC |
Back to
Perl Monks Discussion