private static readonly byte[] workspace = new byte[30000];
private const string source = @"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
private static int wIndex = 0;
private static int sIndex = 0;
public static void Main()
private static bool HandleFuck()
if (sIndex >= source.Length)
switch ((char)source[sIndex])
Console.Write((char)workspace[wIndex]);
if (workspace[wIndex] == 0)
sIndex = GetMatchingLoop(forward: true);
if (workspace[wIndex] != 0)
sIndex = GetMatchingLoop(forward: false);
workspace[wIndex] = Convert.ToByte(Console.ReadKey());
private static int GetMatchingLoop(bool forward)
var offset = forward ? 1 : -1;
var bad = forward ? '[' : ']';
var good = forward ? ']' : '[';
while(i <= source.Length && i >= 0)