Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Sainthood via Seniority Simulation

by planetscape (Canon)
on Nov 11, 2005 at 01:53 UTC ( #507605=note: print w/ replies, xml ) Need Help??


in reply to Sainthood via Seniority Simulation

A trivial update for the new 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 => 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 = <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} < 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; }

Now repeat after me: "I am not an XP whore... I am not an XP whore..." ;-)

planetscape


Comment on Re: Sainthood via Seniority Simulation
Download Code
Re^2: Sainthood via Seniority Simulation
by ysth (Canon) on Nov 11, 2005 at 05:01 UTC
    Thanks for saving me the trouble of doing this. An average of 10 runs shows 22.46 years to reach Saint :)

      Och. It was no tribble at all... ;-)

      planetscape

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://507605]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2015-07-02 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls