Exemple #1
0
        public string SolvePart2()
        {
            Input[0] = 2;         // Play for free ^_^

            var ac = new ArcadeCabinet(Input);

            ac.InitialiseGrid();

            while (ac.BlockCount > 0)
            {
                if (ac.BallLocation.X < ac.PaddleLocation.X)
                {
                    ac.MoveJoyStick(Direction.Left);
                }
                else if (ac.BallLocation.X > ac.PaddleLocation.X)
                {
                    ac.MoveJoyStick(Direction.Right);
                }
                else
                {
                    ac.MoveJoyStick(Direction.Neutral);
                }
            }

            return($"Part 2: {ac.Score}");
        }
Exemple #2
0
        public string SolvePart1()
        {
            var ac = new ArcadeCabinet(Input);

            ac.InitialiseGrid();

            return($"Part 1: {ac.BlockCount}");
        }