private bool IsInTractorBeam(int x, int y, IntCodeVM2 vm) { vm.Reset(); vm.AddInput(x); vm.AddInput(y); vm.ExecuteProgram(); return(vm.GetLastOutput() == 1); }
/// <inheritdoc /> public string Part1() { IntCodeVM2 vm = new IntCodeVM2(program); vm.ExecuteProgram(); List <List <char> > area = new List <List <char> >(); int total = 0; for (int i = 0; i < 50; i++) { area.Add(new List <char>()); for (int j = 0; j < 50; j++) { vm.Reset(); vm.AddInput(j); // x vm.AddInput(i); // y vm.ResumeProgram(); if (vm.GetLastOutput() == 0) { area[i].Add('.'); Console.Write('.'); } else { area[i].Add('#'); Console.Write('#'); total++; } } Console.WriteLine(); } return($"{total} points are affected"); }