Talk:Huh?

From Esolang
Jump to navigation Jump to search

I have figured out how this language works by decompiling huh.exe. Should I put the source here or does that ruin the mystery? --Jell-E (talk) 15:33, 26 August 2014 (UTC)

For anyone interested this is the sourcecode (C#), I won't put it on the main page to preserve the mystery a little bit:
using System;
using System.Diagnostics;
using System.IO;
using System.Media;
using System.Text;

namespace huh
{
    class Program
    {
        private static int Count;

        static void Main(string[] args)
        {
            try
            {
                foreach (string str in args)
                {
                    foreach (string str2 in File.ReadAllLines(str))
                    {
                        switch ((str2.Length % 8))
                        {
                            case 0:
                                Console.WriteLine("Huh?");
                                Count++;
                                break;

                            case 1:
                                Console.WriteLine("...?");
                                Count--;
                                break;

                            case 2:
                                Console.WriteLine("What?");
                                Count *= 3;
                                break;

                            case 3:
                                Console.WriteLine("Ummmmm...");
                                Count /= 3;
                                break;

                            case 4:
                                Console.WriteLine("Okay?");
                                Count = Count >> 1;
                                break;

                            case 5:
                                Console.WriteLine("!?");
                                Count = Count << 1;
                                break;

                            case 6:
                                Console.WriteLine("Hmmmmm...");
                                Count = 0;
                                break;

                            case 7:
                                Console.WriteLine("Ith...?");
                                Count = Count;
                                break;

                            default:
                                Console.WriteLine("Ooooooh!");
                                Count = ~Count;
                                break;
                        }
                    }
                }
                switch (Count)
                {
                    case 0:
                        Console.WriteLine("?");
                        return;

                    case 1:
                        Console.WriteLine("I think I understand.");
                        SystemSounds.Exclamation.Play();
                        return;

                    case 10:
                        Console.WriteLine("Understood...");
                        Process.Start(@"C:\Windows\System32\mspaint.exe");
                        return;

                    case 0x7b:
                        Console.WriteLine("HUH???");
                        Environment.Exit(-123);
                        return;

                    case 0x29a:
                        Console.WriteLine("No...");
                        Console.Beep();
                        return;
                }
                Console.WriteLine("...");
                File.WriteAllText("Notes.txt", DateTime.Today.ToLongDateString() + " - The user tried to give me commands again.  I still have no idea what they are talking about..." + Environment.NewLine);
            }
            catch (Exception)
            {
                Console.Error.WriteLine("Ouch!");
            }
        }
    }
}
--Jell-E (talk) 16:57, 26 August 2014 (UTC)