예제 #1
0
    public Int part_two(string input)
    {
        var computer = Computer.Parse(input).Update(position: 0, value: 2);
        var game     = new Arcade().Update(computer.Run(new RunArguments(
                                                            haltOnInput: true,
                                                            haltOnOutput: false)).Output);

        while (!computer.Finished)
        {
            var move    = Math.Sign(game.Ball.X - game.Paddle.X);
            var results = computer.Run(new RunArguments(
                                           haltOnInput: true,
                                           haltOnOutput: false, move));
            game.Update(results.Output);
        }
        return(game.Score);
    }