Esempio n. 1
0
        static void Main(string[] args)
        {
            int           steps = 12172063;
            TuringMachine mach  = new TuringMachine(steps);

            Console.WriteLine(mach.MakeSteps(steps));
        }
Esempio n. 2
0
        private static void Main()
        {
            var instructions  = File.ReadAllLines("Input.txt");
            var turingMachine = new TuringMachine(instructions.ToList());

            turingMachine.ExecuteBlueprint();

            Console.WriteLine($"The diagnostic checksum is: {turingMachine.CalculateChecksum()}");
        }
Esempio n. 3
0
        static void PartOne()
        {
            var machine = new TuringMachine();

            for (int i = 0; i < 12_861_455; i++)
            {
                machine.Run();
                if (i % 128614 == 0)
                {
                    Console.WriteLine("Working..." + i / 128614 + "%");
                }
            }
            Console.WriteLine(machine.GetTrueCount());
        }
Esempio n. 4
0
        public string Run()
        {
            var config  = new FixedConfiguration();
            var machine = new TuringMachine(config);

            Console.WriteLine(machine);

            for (var i = 0; i < config.NumberOfRuns; i++)
            {
                machine.Step();
            }

            return(machine.CalculateChecksum().ToString());
        }