So, I'll try to keep it simple.
It's only slightly related to programming itself, so I've put it in here.
Thing is: I'm writing a simple game. And it contains some slightly adult-like texts, like "Hi, sweetie, what such a beautie as you does in a place like this?" and so on. But, if you are male, lines like these coming out of some another male's mouth can be disturbing, unless you're certain type of person.
In short words, I need to determine if one is male or female. Preferably by reading it from his/hers name. Is there any way of solving it? Thx in advance ;)
For a small amount of names you can see the genger from the last letter(s). For example, names that end on an "a", "e" and "ix" are normaly names from a female (dispites helios' example), while names ending on "or", "us" etc. are normally males. Those names normally comes from old languages (Latin), and only cover a small amount of all the names.
So I recommend you to simply ask the user for its genger, especially if it is important for the game. If you really dont want to do that, you will probably end up using a list like helios suggested, with some possible mistakes where names are used for both males and females.
Agreed. There is a disturbingly increasing trend these days (at least here in USA) to giving children opposite-sex names --though that has been happening for aeons.
There is also the problem of unisex names, like Ashley and Dana [yes, both originally men's names].
Lastly, the range of names is so great, even limiting the player's nationality is not sufficient to create a useable heuristic to determine gender from name alone. Even in places like France, where there is a government list of required children's names, people will still surprise you.
Perhaps you could disguise the question.
For example, let the player choose someone to take somewhere (like a date). If he chooses a man, he is either a woman or gay. If he chooses a woman, he is either a man or lesbian. Thereafter, you can pretty safely guess the gender --or at least not have to worry about offending him/her with provocative statements.
There are other, more subtle ways to ask too... as the player moves through the game it is easy to slip in questions or options that reveal gender/sexual propensities.
You could also 'force' the question like a lot of games do. For example, in the Star Wars: KOTOR game, you choose your player's identity at the beginning of the game: name, gender, hair color, etc. Do something similar. Like give the user a limited set of personalities to choose from (name, age, sex, etc).