LambdaSix / RenderLike

C# MonoGame based console emulator in the spirit of libtcod
MIT License
1 stars 0 forks source link

Name Generator #4

Closed LambdaSix closed 8 years ago

LambdaSix commented 8 years ago

Implement a random name generator using syllables & phonemes with a configurable rule system.

A name generator would define lists of Syllables in various positional intentions, then combine those into a rule definition. The rule definition is randomly picked when asked to generate a name by that generator.

Any letters not prefixed by a $ are string literal in the output, any underscores are replaced by a space in the output. Rule symbols where a number follows the $ are treated as percentage based and will print that syllable group based on that percentage chance.

For example '$s$50m$e' would define a rule that will generate a first name made of a start, middle and end syllables, but with a 50% chance of not generating the middle syllable in the output.

A special token, %, can be used at the start of a rule to indicate the entire rule has a n percentage chance of running at all, if it fails it's check, another rule will be picked at random. The other special token ? can be used to generate a Phoneme, which is either a Vocal or a Consonant at random with a 50% chance.

A character prefixed with \ is escaped and printed literally, for example \$ or \? print $ and ? without invoking the token exchange.

Sections of a name generator and the symbol used in the rule:

Name Rule Symbol
SyllablePre $[int]P
SyllableStart $[int]s
SyllableMiddle $[int]m
SyllableEnd $[int]e
SyllablePost $[int]p
SyllableVocal $[int]v
SyllableConsonant $[int]c
SyllablePhoneme $[int]?
RuleChancePrefix %
LambdaSix commented 8 years ago

First draft done.

Things left to do are

LambdaSix commented 8 years ago

Change to behaviour: Spaces are captured as part of a literal, they do not need to be (but still can be) escaped, underscores are captured as literal as well

And input rule of "Hello World" will appear as "Hello World" directly.

LambdaSix commented 8 years ago

Fully implemented by 19b5a77