FormeleMethode/RegExpression.cs
/// <summary>
/// Gets all the words that are not in the language.
/// </summary>
/// <param name="maxSteps">The maximum steps.</param>
/// <returns></returns>
Gets all the words that are not in the language.
Gets all the words that are not in the language .
public List<string> GetNotLanguage(int maxSteps)
		{
			SortedSet<string> language = GetLanguage(maxSteps);
			List<string> combinations = new List<string>();
			SortedSet<string> notLangue = new SortedSet<string>();
			List<char> alphabeth = new List<char>();
			if (language.Count <= 0)
				return combinations;
			int longestString = language.Last().Length;
			alphabeth = language.Last().ToCharArray().Distinct().ToList();
			var q = alphabeth.Select(x => x.ToString());
			for (int i = 0; i < longestString - 1; i++)
				q = q.SelectMany(x => alphabeth, (x, y) => x + y);
			combinations = q.ToList();
			combinations.RemoveAll(x => language.Contains(x));
			return combinations;
		}
public List < string > GetNotLanguage ( int maxSteps ) { SortedSet < string > language = GetLanguage ( maxSteps ) ; List < string > combinations = new List < string > ( ) ; SortedSet < string > notLangue = new SortedSet < string > ( ) ; List < char > alphabeth = new List < char > ( ) ; if ( language . Count <= 0 ) return combinations ; int longestString = language . Last ( ) . Length ; alphabeth = language . Last ( ) . ToCharArray ( ) . Distinct ( ) . ToList ( ) ; var q = alphabeth . Select ( x => x . ToString ( ) ) ; for ( int i = 0 ; i < longestString - 1 ; i ++ ) q = q . SelectMany ( x => alphabeth , ( x , y ) => x + y ) ; combinations = q . ToList ( ) ; combinations . RemoveAll ( x => language . Contains ( x ) ) ; return combinations ; }
Gets all the words that are not in the language.
Gets all the words that are not in the language .
// Gets the language // Get longest string length - 1 based // Gets the different chars in alphabeth // Generate all possible strings upto the longestString length // Convert to list // Subtract language from all possible things // Return not language
None
maxSteps
int
The maximum steps.
The maximum steps .