Beispiel #1
0
            public int Run(string input = Input)
            {
                var memory = Input.Split(',').Select(s => BigInteger.Parse(s));
                // probably not the best origin of control, but I don't
                // have to make any changes, sooooo, here's my excuse.
                var cpu  = new IntCodeStateMachine(memory);
                var view = new InMemoryGameView();
                var game = new ArcadeProgram(cpu, view);

                cpu.RunAll();

                var blockCount = view.Memory.Values.Count(t => t == TileType.Block);

                return(blockCount);
            }
Beispiel #2
0
            public int Run(string input = Input)
            {
                var memory = Input.Split(',').Select(s => BigInteger.Parse(s)).ToArray();

                memory[0] = 2; // to play for free!
                var cpu = new IntCodeStateMachine(memory);

                var scoreView = new ScoreView();
                var gameView  = new SegmentDisplay(scoreView, new ConsoleGameView());
                var gameInput = new AiGameInput(cpu);

                var game = new ArcadeProgram(cpu, gameView, gameInput);

                cpu.RunAll();

                Console.Clear();

                return(scoreView.FinalScore);
            }