Results 1 to 10 of 36

Thread: Introduction / my efforts

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12

    Post

    Quote Originally Posted by Redrobes View Post
    I am gonna go and see if I can Perl up your python Elite code.
    Code:
    my $ELITE = 1; # Set to 1 for Elite names, other for random names
    
    my @seed = ($ELITE == 1) ? (0x5A4A, 0x0248, 0xB753)
                             : (int(rand(0xffff)), int(rand(0xffff)), int(rand(0xffff)));
    
    sub tweakseed() {
        push @seed, ($seed[0] + $seed[1] + $seed[2]) % 0x10000;
        shift @seed;
    }
    
    my $digraphs = "..lexegezacebisousesarmaindirea.eratenberalavetiedorquanteisrion";
    
    sub name() {
        my $longnameflag = $seed[0] & 0x40;
    
        my $name = "";
    
        foreach my $n (0 .. 3) {
            my $d = (($seed[2] >> 8) & 0x1f) << 1;
    
            tweakseed();
    
            if ($n < 3 || $longnameflag) {
                $name .= substr($digraphs, $d, 2);
            }
        }
    
        $name =~ s/\.//g;
    
        $name =~ s/^(.)/\U$1/;
    
        return $name;
    }
    Last edited by isomage; 12-06-2008 at 12:19 AM. Reason: Code tweak
    My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •