Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2000:
[Freeciv-Dev] Re: city names (was: It's a game already!)
Home

[Freeciv-Dev] Re: city names (was: It's a game already!)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jules Bean <jmlb2@xxxxxxxxxxxxxxxx>
Cc: Reinier Post <rp@xxxxxxxxxx>, Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: city names (was: It's a game already!)
From: Tobias Brox <tobiasb@xxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Feb 2000 18:02:45 +0100 (MET)

> Someone has an algorithm to randomly generate tolkein-esque names they wrote
> for some angband variant, IIRC -- maybe greg would remember...

Oh ... we had exactly this thing as a mandatory excersise when I was a
student.  I think I should manage to dig out my own piece of code from my 
old archives if anyone is interessted.  It was written in C++ (but other 
students did it in C and Pascal, and nowadays they probably do it in
Java - I might also ask if somebody have some nice C code to contribute if
you're interessted). I was rather proud of it back then, I don't know if
I'm equally proud today :)

A friend of mine used the engine as a tool for generating the kind of 
local northern language which is not commonly accepted in the more
southern parts of Norway.  That piece of code would certainly have been
banned in US and Australia if it had been translated. :)

The excersise specificated the algoritm in detail, as well as
some constraints on the data structure, but I found the excersise quite
fun anyway. Here's the algoritm, from my own memory:

Building the data structure:

- The variable n as well as an input text should be given runtime.  The
input text should be trimmed so all whitespace appeared as one space.

- Each sequence of n characters (blank beeing treated as any other
character) should be stored.

- For each stored character sequence, there should be stored a frequency
count of the following character.

Generating random svada:

- Start with a random sequence.
- Pick a random following character, but weighted according to the
frequency count.
- Deal with text formatting and ending

Oh, I almost feel like making this once more, this time in perl....

-- 
Tobias Brox (alias TobiX) - +4722925871 - _urgent_ emails to
sms@xxxxxxxxxxxxxxxxxx.  Check our upcoming MMORPG at 
http://www.anarchy-online.com/ (Qt) and play multiplayer Spades, 
Backgammon, Poker etc for free at http://www.funcom.com/ (Java)





[Prev in Thread] Current Thread [Next in Thread]