Exemplo n.º 1
0
        //2565
        public static int Solve1(string input)
        {
            var santa = new Position(0, 0);
            var houses = new HashSet<Tuple<int, int>> { new Tuple<int, int>(0, 0) };
            foreach (var direction in input)
                santa.Move(direction).DeliverPresent(houses);

            return houses.Count;
        }
Exemplo n.º 2
0
        public static int Solve2(string input)
        {
            var santa = new Position(0, 0);
            var robot = new Position(0, 0);
            var houses = new HashSet<Tuple<int, int>> { new Tuple<int, int>(0, 0) };

            var moveSanta = true;
            foreach (var direction in input)
            {
                if(moveSanta)
                    santa.Move(direction).DeliverPresent(houses);
                else
                    robot.Move(direction).DeliverPresent(houses);

                moveSanta = !moveSanta;
            }
            return houses.Count;
        }
Exemplo n.º 3
0
 public Position(Position position)
 {
     X = position.X;
     Y = position.Y;
 }