コード例 #1
0
ファイル: Solution.cs プロジェクト: valdal/adventofcode
        Func <int, int, bool> Detector(string input)
        {
            var icm = new ImmutableIntCodeMachine(input);

            return((int x, int y) => {
                var(_, output) = icm.Run(x, y);
                return output[0] == 1;
            });
        }
コード例 #2
0
    public (ImmutableIntCodeMachine iicm, IntCodeOutput output) Run(params string[] input)
    {
        var immutableIntCodeMachine = new ImmutableIntCodeMachine(this.icm.Clone());

        return(immutableIntCodeMachine, immutableIntCodeMachine.icm.Run(input));
    }
コード例 #3
0
ファイル: Solution.cs プロジェクト: valdal/adventofcode
 IEnumerable <(ImmutableIntCodeMachine iicm, ImmutableList <int> path, Tile tile)> Bfs(ImmutableIntCodeMachine startIicm)
 {
     (int dx, int dy)[] dirs = new[] { (0, -1), (0, 1), (-1, 0), (1, 0) };
コード例 #4
0
ファイル: Solution.cs プロジェクト: valdal/adventofcode
        public object PartOne(string input)
        {
            var iicm = new ImmutableIntCodeMachine(input);

            return(Bfs(iicm).First(s => s.tile == Tile.O2).path.Count);
        }