Created
December 25, 2018 19:19
-
-
Save davwheat/07f754e0f1df0f9c682383f38213a38d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class MainClass { | |
static readonly char[] ee = {'b', 'c', 'd', 'e', 'g', 'p', 't', 'v', 'z'}; | |
static readonly char[] ay = {'a', 'h', 'j', 'k'}; | |
static readonly char[] ess = {'f', 's', 'x'}; | |
static readonly char[] ii = {'i', 'y'}; | |
static readonly char[] em = {'m', 'n'}; | |
static readonly char[] u = {'q', 'u'}; | |
public static void Main (string[] args) { | |
Console.Write("Enter text: "); | |
var UserInput = Console.ReadLine(); | |
Console.WriteLine(); | |
Console.WriteLine("We're going to test every possibility. This may take a while..."); | |
Console.WriteLine(); | |
foreach (char c in UserInput) { | |
Console.WriteLine("=========="); | |
Console.WriteLine(c); | |
var chars = GetAllPossibleChars(char.ToLower(c)); | |
if (chars == null) { | |
continue; | |
} | |
if (char.IsUpper(c)) { | |
chars = CapitaliseCharArray(ref chars); | |
} | |
Console.WriteLine(chars); | |
} | |
} | |
static char[] GetAllPossibleChars(char c) { | |
char[] array; | |
c = char.ToLower(c); | |
Console.WriteLine(c); | |
if (ee.Contains(c)) | |
array = ee; | |
else if (ay.Contains(c)) | |
array = ay; | |
else if (ess.Contains(c)) | |
array = ess; | |
else if (ii.Contains(c)) | |
array = ii; | |
else if (em.Contains(c)) | |
array = em; | |
else if (u.Contains(c)) | |
array = u; | |
else { | |
Console.WriteLine("YEET"); | |
return null; | |
} | |
return array; | |
} | |
static char[] CapitaliseCharArray(ref char[] array) { | |
var i=0; | |
foreach (char c in array) { | |
array[i] = char.ToUpper(c); | |
i++; | |
} | |
return array; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment