예제 #1
0
        public string Answer2()
        {
            foreach (FloorTile f in FloorTile.GetAllTiles())
            {
                f.GenerateNeighbours();
            }
            for (int i = 0; i < 100; i++)
            {
                foreach (FloorTile f in FloorTile.GetAllTiles())
                {
                    f.GenerateNeighbours();
                }
                FloorTile.UpdateAllTiles();
            }
            List <FloorTile> usedTiles = FloorTile.GetAllTiles();
            int count = 0;

            foreach (FloorTile f in usedTiles)
            {
                if (f.IsBlack)
                {
                    count++;
                }
            }
            return(count.ToString());
        }
예제 #2
0
 public Day24(List <string> d)
 {
     foreach (string s in d)
     {
         FloorTile ft = FloorTile.GenerateFloorTile(s);
         ft.Flip();
     }
 }
예제 #3
0
        public string Answer1()
        {
            List <FloorTile> usedTiles = FloorTile.GetAllTiles();
            int count = 0;

            foreach (FloorTile f in usedTiles)
            {
                if (f.IsBlack)
                {
                    count++;
                }
            }
            return(count.ToString());
        }
예제 #4
0
        public List <FloorTile> GetNeighbours()
        {
            List <FloorTile> answer = new List <FloorTile>();
            FloorTile        e      = new FloorTile(location + "e");

            answer.Add(e);
            FloorTile w = new FloorTile(location + "w");

            answer.Add(w);
            FloorTile ne = new FloorTile(location + "ne");

            answer.Add(ne);
            FloorTile se = new FloorTile(location + "se");

            answer.Add(se);
            FloorTile nw = new FloorTile(location + "nw");

            answer.Add(nw);
            FloorTile sw = new FloorTile(location + "sw");

            answer.Add(sw);
            return(answer);
        }