Created
December 16, 2022 02:16
-
-
Save stevehjohn/4cd65003a055fc42bc95fcaf83b41657 to your computer and use it in GitHub Desktop.
AoC 2022.15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var l = 0; l < _sensors.Count; l++) | |
{ | |
var sensorL = _sensors[l]; | |
for (var r = 1; r < _sensors.Count; r++) | |
{ | |
var sensorR = _sensors[r]; | |
var targetDelta = sensorL.ManhattanRange + sensorR.ManhattanRange + 2; | |
var delta = Math.Abs(sensorL.Position.X - sensorR.Position.X) + Math.Abs(sensorL.Position.Y - sensorR.Position.Y); | |
if (delta == targetDelta) | |
{ | |
Console.WriteLine($"{l}, {r}"); | |
/* | |
* 2, 11 | |
* 11, 2 | |
* 12, 13 | |
* 13, 12 | |
*/ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment