Exemple #1
0
        static void Main(string[] args)
        {
            var lines = System.IO.File.ReadAllLines("input.txt");
            Dictionary <HexCo, bool> tiles = new Dictionary <HexCo, bool>();

            foreach (var line in lines)
            {
                var hex = HexCo.GoPath(line);
                if (!tiles.ContainsKey(hex))
                {
                    tiles[hex] = true;
                }
                else
                {
                    tiles[hex] = !tiles[hex];
                }
            }

            int result = 0;

            foreach (var pair in tiles)
            {
                if (pair.Value)
                {
                    result++;
                }
            }
            Console.WriteLine(result);
        }
Exemple #2
0
        public static HexCo GoPath(string path)
        {
            var result = new HexCo();

            while (path != String.Empty)
            {
                int chars = 1;
                if (path.StartsWith("s") || path.StartsWith("n"))
                {
                    chars = 2;
                }
                result.Inc(path.Substring(0, chars));
                path = path.Substring(chars);
            }

            return(result);
        }
Exemple #3
0
 protected bool Equals(HexCo other)
 {
     return(X == other.X && Y == other.Y);
 }