예제 #1
0
파일: WireGrid.cs 프로젝트: mckean1/aoc
        private void AddWireCell(int x, int y)
        {
            WireCellLookup wireCellLookup = new WireCellLookup
            {
                X = x,
                Y = y
            };

            WireCell wireCell = new WireCell
            {
                X          = x,
                Y          = y,
                WireNumber = currentWireNumber
            };

            bool isCrossing = wireCells.TryAdd(wireCellLookup, wireCell);

            if (!isCrossing && !IsSameWire(wireCellLookup))
            {
                Logger.Log($"Intersection at X: {x} and Y: {y}.");
                wireCells[wireCellLookup].IsIntersection = true;
            }
        }
예제 #2
0
파일: WireGrid.cs 프로젝트: mckean1/aoc
 private bool IsSameWire(WireCellLookup wireCellLookup)
 {
     return(wireCells[wireCellLookup].WireNumber == currentWireNumber);
 }