Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

universe.pl

by repson (Chaplain)
on Nov 25, 2000 at 09:17 UTC ( #43300=poem: print w/ replies, xml ) Need Help??

This is my first try of Perl poetry type things.
This program proves that Perl is the language of the gods.
Sorry if it offends anyone, it isn't intended to
#!/universe/bin/perl -U # Maintainer : God # Revision history : None, made this while bored # Notes : could be a few bugs # : couldn't get it to work with warnings,strict or taint package Lifeform::Human; use vars qw/@ISA $VERSION/; $VERSION = 0.001; # very, very, very alpha @ISA = qw/Lifeform::base/; sub new { my $class = shift; my $person = $class->SUPER::new(@_); $person->{Location} ||= 'infinity'; unless ($person->{father}) { $person->{bastard} = 1; $person->{fath +er} = new Lifeform::base } unless ($person->{mother}) { $person->{flags} = 0xFFFFFF; $person-> +{mother} = new Lifeform::base } for (0..@{$person->{mother}->{chromosones}) { push @{$person->{chromosones}}, do_foo( $person->{mother}->{chromosones}->{$_}, $person->{father}->{chromosones}->{$_}); } bless($person, $class) if defined($person->{good}); $person->create; return $person; } sub kill { my ($person, $killer) = @_; $person->{dead} = 1; push @{$GROUND}, split(//,$person->{body}); $killer->damn( To => Hell ) if ($killer ne $TIME); } package main; use Universe; use Lifeform::Human; use vars qw/@people/; my $Universe = new Universe; my $Earth = $Universe->create(Type => 'World'); my $adam = new Lifeform::Human(Location => $Earth); my $eve = $adam->clone; $eve->alter('gender','f'); $child = new Human(father => $adam, mother => $eve); @people=($adam,$eve,$child); while ($Universe->exists and $Universe->stable) { push @people, new Human (father => $people[rand(@people)], mother => $people[rand(@people)]); $Earth->destroy(Amount => (@people/(10**20)), Part => 'random'); } undef @people; undef $Earth; undef $Universe; close; die;

Comment on universe.pl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-07-29 00:49 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 (260 votes), past polls