# 2009-09-11 Random Subsector Generator

Once I had the name generator, I was ready to write up the rest of the script. The subsector UWP list generator will also compute the temperature for internal purposes, but doesn’t print it because it’s not part of the UWP.

I decided that systems with code Amber and piratets are considered code Red. The rules just say that “Red codes are given out at the discretion of the Referee.”

The cool thing is that you can paste & copy the resulting list into the map generator and generate the map to go along with it.

# 2009-09-11 Elite Names

I’m thinking of a system name generator for my upcoming Traveller UWP generator.

I was trying to write code in Perl, based on code in Python [1], based on code in C [2], reverse engineered from assembly code written for the BBC – the Elite random name generator. The fool that I was – I didn’t realize that just a a few posts later [3] somebody had done just that.

Then I started wondering: How the hell did this work? How much of the magic was just a pseudo random number generator? Clearly the algorithm was picking pairs of characters from the digraph string. There was an element controlling the length of the name, and that’s it? I tried it, but the names were less than stellar. Then I realized that the digraph string probably listed pairs that went together well. I should not be picking starting characters at random, I should be picking pairs at random. The result is this:

my $digraphs = "..lexegezacebisousesarmaindire.aeratenberalavetiedorquanteisrion"; my$max = length($digraphs); sub name { my$length = 5 + rand(5); # 4-8
my $name = ''; while (length($name) < $length) {$name .= substr($digraphs, 2*int(rand($max/2)), 2);
}
$name =~ s/\.//g; return$name;
}

for my $n (0..100) { printf "%3d. %s\n",$n, name();
}

Random names:

  1. ertexebeis
2. cetiisar
3. marain
4. atsocezaat
5. biraza
6. tezaordi
7. beenes
8. orxeesle
9. quxeisis
10. errabiat
11. riquatis
12. inisered
13. diraanated
14. orquisbiqu
15. arvevein
16. lebereza
17. gemazaisen
19. isbixebiti
20. vemama

Sounds good to me!

And by changing the digraph, you can get different sounds, too.

my $digraphs = "fafemalunabararerixevivoine.n.q.pazizozutatetitotu.."; Results in this list:  1. zuravo 2. zobarati 3. zireqti 4. efare 5. votuqbain 6. vomafezo 7. fantaetu 8. xeinra 9. ferati 10. ribabata I like it! More variation in name length?  my$length = 4 + rand(7); # 4-8

Awesome.

Back when I was trying out StackOverflow (I later learned to dislike it), I tackled a similar problem about phonetic passwords. My solution would concatentate words from the dictionary. The more elegant answer that was accepted suggested a well known method using digraphs (maybe even trigraphs).

The digraph is a much better solution, and I think using a string as the data structure as you have done is not only sharp, but its also makes it easier to understand how it works.

AaronHawley 2009-09-16 22:21 UTC

The thing I really liked about the solution was how it uses the dot to produce shorter than expected words (if you use «..») and how you can generate three-letter syllables (if you use «.»). I thought of Japanese were you have combinations of the consonants k, s, t, n, h, m, b, s, z followed by a, e, i, o, u, ya, yu, yo (but no ye and yi), the vocals themselves, and the letter n by itself. You can represent that using the following:

my \$digraphs = "kakekikokusasesisosutatetitotunaneninonuhahehihohu"
. "mamemimomubabebibobusasesisosuzazezizozuyayuyoa.e.i.o.u.n.";

The only obvious problem is the placement of the single n at the beginning of a word, and the distribution of the syllables used. Not too shabby:

0. misakumeho 1. zukunahimi 2. misekusohi 3. hosato 4. nahokesu 5. titizobuha 6. keeyosuo 7. kimotizi 8. ihosikahi 9. misouisu

Ovious «n» endings, for example:

10. setanheo 34. bayonunyu 42. nhezase 57. hihezenin

)

AlexSchroeder 2009-09-16 23:03 UTC

All this reminds me of the Dada Engine.