예제 #1
0
        static void Main(string[] args)
        {
            List <String> rawData      = PassDataToList("assets/input.txt");
            List <MapRow> fomattedRows = MapRow.FormatList(rawData);

            QuestionOne(fomattedRows);
            QuestionTwo(fomattedRows);
        }
예제 #2
0
        public static List <MapRow> FormatList(List <String> rows)
        {
            List <MapRow> formattedList = new List <MapRow>();
            int           i             = 0;

            foreach (var row in rows)
            {
                var mapRow = new MapRow();
                mapRow.terrain = row.ToCharArray();
                mapRow.index   = i;
                formattedList.Add(mapRow);
                i++;
            }
            return(formattedList);
        }
예제 #3
0
        static void QuestionTwo(List <MapRow> fomattedRows)
        {
            int resultOne   = MapRow.CheckSlope(fomattedRows, 1, 1);
            int resultTwo   = MapRow.CheckSlope(fomattedRows, 3, 1);
            int resultThree = MapRow.CheckSlope(fomattedRows, 5, 1);
            int resultFour  = MapRow.CheckSlope(fomattedRows, 7, 1);
            int resultFive  = MapRow.CheckSlope(fomattedRows, 1, 2);

            long result =
                Convert.ToInt64(resultOne)
                * Convert.ToInt64(resultTwo)
                * Convert.ToInt64(resultThree)
                * Convert.ToInt64(resultFour)
                * Convert.ToInt64(resultFive)
            ;

            Console.WriteLine("Tree count is: {0}.", result);
        }
예제 #4
0
        static void QuestionOne(List <MapRow> fomattedRows)
        {
            int result = MapRow.CheckSlope(fomattedRows, 3, 1);

            Console.WriteLine("Question one tree count is: {0}.", result);
        }