Nighed

joined 2 years ago
MODERATOR OF
[–] Nighed@sffa.community 2 points 2 years ago

It's on a big hill, the archeology isn't going to be more than 10m deep right? The only issue will therefore be at the entrance and exit?

I assume that they put the portals in 'empty' places and will have archeologists at the site to confirm they are not digging things up. (And have/are studying the area more)

[–] Nighed@sffa.community 2 points 2 years ago (3 children)

If your happy to wear a fitness tracker there are lots of options by companies such as Garmin.

Not sure about phone only ones

[–] Nighed@sffa.community 3 points 2 years ago

Can you update your original comment then please. The cut and cover idea is unfortunately believable.

[–] Nighed@sffa.community 3 points 2 years ago (5 children)

What damage are you expecting?

[–] Nighed@sffa.community 0 points 2 years ago* (last edited 2 years ago) (2 children)

If they dig under it, then there is very little effect and it gets rid of the busy, noisy and slow main road that goes right by it.

I'm getting downvoted - what damage are you worried about?

[–] Nighed@sffa.community -3 points 2 years ago (2 children)

If they dig under then it's not a problem

[–] Nighed@sffa.community 6 points 2 years ago* (last edited 2 years ago) (2 children)

Can you source the cut and fill bit - everything I can see says it's twin bore: https://nationalhighways.co.uk/our-roads/a303-stonehenge/about-the-scheme/

[–] Nighed@sffa.community 8 points 2 years ago* (last edited 2 years ago)

Oh shit, their doing cut and cover? That's crazy!

The druids are right!

Edit: not sure this is correct? https://nationalhighways.co.uk/our-roads/a303-stonehenge/about-the-scheme/ indicates twin bore

[–] Nighed@sffa.community 3 points 2 years ago (1 children)

I don't think you can have private communities currently?

[–] Nighed@sffa.community 3 points 2 years ago* (last edited 2 years ago)

C# I had fun with this one and overbuilt it somewhat. Disappointed I didn't get/need to implement Dijkstra's algorithm.

For part two I did a x2 expand, so the example input expanded and found the middles like this (0s for the targets as their easier to distinguish):

Part 1

namespace AdventOfCode2023.Days.Ten
{
    internal class Day10Task1 : IRunnable
    {
        private HashSet<(int, int)> _visitedNodes = new HashSet<(int, int)>();

        public void Run()
        {
            //var inputLines = File.ReadAllLines("Days/Ten/Day10ExampleInput.txt");
            //var inputLines = File.ReadAllLines("Days/Ten/Day10ExampleInput2.txt");
            var inputLines = File.ReadAllLines("Days/Ten/Day10Input.txt");

            var map = new PipeMap(inputLines);
            _visitedNodes.Add((map.XCoord, map.YCoord));

            while (true)
            {
                bool haveMoved = false;
                for (int i = 0; i < 4; i++)
                {
                    if (map.CanMove((Direction)i))
                    {
                        map.Move((Direction)i);
                        if (_visitedNodes.Contains((map.XCoord, map.YCoord)))
                        {
                            map.Move(GetOppositeDirection((Direction)i));
                        }
                        else
                        {
                            _visitedNodes.Add((map.XCoord, map.YCoord));
                            haveMoved = true;
                        }
                    }
                }

                if (!haveMoved)
                {
                    break;
                }
            }

            Console.WriteLine("Nodes Visited: "+ _visitedNodes.Count);
            Console.WriteLine("Furthest Node: "+ _visitedNodes.Count/2);

        }




        public class PipeMap
        {
            public int XCoord { get; private set; }
            public int YCoord { get; private set; }
            public char CurrentPipe { get { return Map[YCoord][XCoord]; } }

            private string[] Map { get; set; }

            public PipeMap(string[] mapString)
            {
                Map = mapString;

                for (int y = 0; y < mapString.Length; y++)
                {
                    for (int x = 0; x < mapString[y].Length; x++)
                    {
                        if (mapString[y][x] == 'S')
                        {
                            YCoord = y;
                            XCoord = x;
                        }
                    }
                }
            }

            public void Move(Direction direction)
            {
                var adjacent = GetAdjacent(direction);

                XCoord = adjacent.Item1;
                YCoord = adjacent.Item2;
            }

            public bool CanMove(Direction direction)
            {
                bool currentPositionAllow = CanMoveFromCoord(direction, XCoord, YCoord);

                if (!currentPositionAllow) return false;

                var adjacent = GetAdjacent(direction);

                if (adjacent.Item3 != '.' && CanMoveFromCoord(GetOppositeDirection(direction), adjacent.Item1, adjacent.Item2))
                {
                    return true;
                }

                return false;
            }

            private bool CanMoveFromCoord(Direction direction, int xCoord, int yCoord)
            {
                switch (Map[yCoord][xCoord])
                {
                    case '|':
                        return direction == Direction.Up || direction == Direction.Down;
                    case '-':
                        return direction == Direction.Left || direction == Direction.Right;
                    case 'L':
                        return direction == Direction.Up || direction == Direction.Right;
                    case 'J':
                        return direction == Direction.Up || direction == Direction.Left;
                    case '7':
                        return direction == Direction.Left || direction == Direction.Down;
                    case 'F':
                        return direction == Direction.Right || direction == Direction.Down;
                    case 'S':
                        return true;
                    case '.':
                    default:
                        throw new Exception("you dun fucked up");
                }
            }

            private (int, int, char) GetAdjacent(Direction direction)
            {
                var newXCoord = XCoord;
                var newYCoord = YCoord;

                switch (direction)
                {
                    case Direction.Up:
                        newYCoord--;
                        break;
                    case Direction.Down:
                        newYCoord++;
                        break;
                    case Direction.Left:
                        newXCoord--;
                        break;
                    case Direction.Right:
                        newXCoord++;
                        break;
                }

                return (newXCoord, newYCoord, Map[newYCoord][newXCoord]);
            }
        }

        public enum Direction
        {
            Up, Right, Down, Left
        }

        public static Direction GetOppositeDirection(Direction direction)
        {
            switch (direction)
            {
                case Direction.Up:
                    return Direction.Down;
                case Direction.Down:
                    return Direction.Up;
                case Direction.Right:
                    return Direction.Left;
                case Direction.Left:
                    return Direction.Right;
                default: throw new Exception("You dun fucked up... again");
            }
        }
    }


}

Part 2 is too big to post... see pastebin link

[–] Nighed@sffa.community 2 points 2 years ago

haha, thats genius

[–] Nighed@sffa.community 1 points 2 years ago

huh... expand x2 worked for me. I wonder if I had a nice input set

view more: ‹ prev next ›