Table of Contents

Method MutateWord

Namespace
Gamelogic.Words
Assembly
Gamelogic.Words.dll

MutateWord(Word, int, IWordAlphabet, IRandom)

Mutates a word to ensure a specific edit distance. Can add, remove, and mutate letters

public static Word MutateWord(Word word, int minEditDistance, IWordAlphabet alphabet, IRandom random)

Parameters

word Word

The word to mutate

minEditDistance int

The minimum edit distance to ensure

alphabet IWordAlphabet

The alphabet we're operating with

random IRandom

The random generator to use.

Returns

Word

The mutated word

Remarks

While it is valid to specify an edit distance higher than the length of the word, this is not recommended. It is entirely possible for the algorithm to take a long time to complete, or to never terminate at all, if this value is too high. A sane range would keep the value between 2 and word.Length

Exceptions

ArgumentNullException

alphabet or word is null

MutateWord(Word, int, int, IWordAlphabet, IRandom)

Mutates a word to ensure a specific edit distance. Can add, remove, and mutate letters

public static Word MutateWord(Word word, int minEditDistance, int minWordLength, IWordAlphabet alphabet, IRandom random)

Parameters

word Word

The word to mutate

minEditDistance int

The minimum edit distance to ensure

minWordLength int

A minimum word length to maintain. The mutation will never remove more characters than this

alphabet IWordAlphabet

The alphabet we're operating with

random IRandom

The random generator to use.

Returns

Word

The mutated word

Remarks

While it is valid to specify an edit distance higher than the length of the word, this is not recommended. It is entirely possible for the algorithm to take a long time to complete, or to never terminate at all, if this value is too high. A sane range would keep the value between 2 and word.Length

Exceptions

ArgumentNullException

alphabet or word is null

MutateWord(Word, IWordDictionary, IRandom)

Mutates a word to ensure a that no substrings are valid words

public static Word MutateWord(Word word, IWordDictionary dictionary, IRandom random)

Parameters

word Word

The word to mutate

dictionary IWordDictionary

The dictionary to use to look for subwords

random IRandom

The random generator to use.

Returns

Word

The mutated word

Remarks

In the event that the source word already contains no substrings, no mutation operations will be performed and the source word will be returned as-is

Exceptions

ArgumentNullException

dictionary or word is null

MutateWord(Word, int, IWordDictionary, IRandom)

Mutates a word to ensure a that no substrings are valid words

public static Word MutateWord(Word word, int minWordLength, IWordDictionary dictionary, IRandom random)

Parameters

word Word

The word to mutate

minWordLength int

A minimum word length to maintain. The mutation will never remove more characters than this

dictionary IWordDictionary

The dictionary to use to look for subwords

random IRandom

The random generator to use.

Returns

Word

The mutated word

Remarks

In the event that the source word already contains no substrings, no mutation operations will be performed and the source word will be returned as-is

Exceptions

ArgumentNullException

dictionary or word is null