[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
- [Freeciv-Dev] Re: It's a game already!, (continued)
- [Freeciv-Dev] Re: It's a game already!, Reinier Post, 2000/02/16
- [Freeciv-Dev] Re: It's a game already!, Stephen Hodge, 2000/02/17
- [Freeciv-Dev] city names (was: It's a game already!), Reinier Post, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Jules Bean, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Tobias Brox, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Reinier Post, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Robert Brady, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Jules Bean, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Reinier Post, 2000/02/17
- [Freeciv-Dev] Re: city names (was: It's a game already!), Falk Hueffner, 2000/02/17
- [Freeciv-Dev] algorithm to generate city names (was: city names (was: It's a game already!)),
Reinier Post <=
[Freeciv-Dev] Re: It's a game already!, Jason Todd, 2000/02/18
|
|