public override void PartTwo() { var c = Computer.From(InputLine); var data = new DataLink(); c.LineIn = data.Output; c.LineOut = Computer.ConsoleOutput(); data.Insert(5); c.Execute(); }
public bool TryMove(Pos offset, out int sense) { var dir = offset switch { (0, 1) => 1, (0, -1) => 2, (-1, 0) => 3, (1, 0) => 4, _ => throw new Exception("Invalid offset") }; _data.Insert(dir); sense = _controller.NextInt(); if (sense != Wall) { Position += offset; Map[Position] = sense; return(true); } Map[Position + offset] = sense; return(false); }