Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2000:
[Freeciv-Dev] algorithm to generate city names (was: city names (was: It
Home

[Freeciv-Dev] algorithm to generate city names (was: city names (was: It

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] algorithm to generate city names (was: city names (was: It's a game already!))
From: Reinier Post <rp@xxxxxxxxxx>
Date: Fri, 18 Feb 2000 13:24:12 +0100

Hmm, interesting: an elegant algorithm to guarantee that names
only contain 3-substrings occurring in the existing name list.

Good results, too: 80% of your list look like a genuine Dutch name.

[to quote the essential part:]

> +    len = strlen(all_citynames);
> +    for (i = 0; i < 1000; i++) {
> +      do {
> +     p = myrand(len - 1);
> +     tempname[0] = all_citynames[p];
> +     tempname[1] = all_citynames[p + 1];
> +      } while (!isupper(tempname[0]));
> +
> +      c = 1;
> +      do {
> +     p = myrand(len - 1);
> +     if (all_citynames[p] == tempname[c] && all_citynames[p - 1] == 
> tempname[c - 1])
> +       tempname[++c] = all_citynames[p + 1];
> +      } while(tempname[c] != '\n');

I'm all for including this into CVS.

-- 
Reinier



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