Esempio n. 1
0
        /// <summary>
        /// Gets the redistribution cycle.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="cycle">The cycle.</param>
        /// <returns></returns>
        public static int GetRedistributionCycle(string fileName, out int cycle)
        {
            string path        = ReadFromTextFile.GetFilePath(fileName);
            string dataStrings = ReadFromTextFile.GetString(path);

            return(GetRedistributionCycle(DataHelper.GetDataAsIntegerArray(dataStrings), out cycle));
        }
        public static int GetSumOfEvenlyDivisableValues(string fileName)
        {
            string path = ReadFromTextFile.GetFilePath(fileName);

            string[] dataString = ReadFromTextFile.GetAllLines(path);

            return(GetSumOfEvenlyDivisableValues(dataString));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the lagest register value.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="highestValueHeld">The highest value held.</param>
        /// <returns>The largest value from registers.</returns>
        public static int GetLagestRegisterValue(string fileName, out int highestValueHeld)
        {
            string fullPath = ReadFromTextFile.GetFilePath(fileName);

            string[] dataString = ReadFromTextFile.GetAllLines(fullPath);

            return(GetLagestRegisterValue(dataString, out highestValueHeld));
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the name of the bottom program.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <returns></returns>
        public static string GetBottomProgramName(string fileName, out int correctedWeight)
        {
            string filePath = ReadFromTextFile.GetFilePath(fileName);

            string[] fileContent = ReadFromTextFile.GetAllLines(filePath);

            return(GetBottomProgramName(fileContent, out correctedWeight));
        }
        /// <summary>
        /// Gets the valid passphrases.
        /// </summary>
        /// <param name="textFilepath">The text filepath.</param>
        /// <returns>Count of Valid paraphrases.</returns>
        public static int GetSecurePassphrases(string textFilepath)
        {
            string dataPath = ReadFromTextFile.GetFilePath(textFilepath);

            string[] data = ReadFromTextFile.GetAllLines(dataPath);

            return(GetSecurePassphrases(data));
        }
        /// <summary>
        /// Gets the corruption checksum from text file.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <returns>Running sum.</returns>
        public static int GetCorruptionChecksumFromTextFile(string fileName)
        {
            string dataPath = ReadFromTextFile.GetFilePath(fileName);

            string[] data = ReadFromTextFile.GetAllLines(dataPath);

            return(GetCorruptionChecksum(data));
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the number of steps to come out from maze.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <returns>step count.</returns>
        public static int GetNumberOfStepsToComeOutFromMaze(string fileName, PuzzlePart part = PuzzlePart.One)
        {
            string path = ReadFromTextFile.GetFilePath(fileName);

            string[] dataString = ReadFromTextFile.GetAllLines(path);
            int[]    data       = dataString.Select(int.Parse).ToArray();

            return(GetNumberOfStepsToComeOutFromMaze(data, part));
        }