Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves the algorithm for a given position
        /// </summary>
        /// <param name="posNum">The number of a rubik's cube position</param>
        /// <returns></returns>
        public string GetAlg(int posNum)
        {
            if (posNum < 0 || posNum >= _file.NumAlgs)
            {
                throw new ArgumentOutOfRangeException("illegal position number: " + posNum);
            }
            Algorithm alg = _file.Read(posNum);

            return(alg.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of AlgsFromFileStored
        /// </summary>
        /// <param name="fileName"></param>
        public AlgsFromFileStored(string fileName)
        {
            _algs = new List <Algorithm>();
            var file = new AlgFile(fileName, AlgFileMode.Open, AlgFileAccess.Read);

            for (int k = 0; k < file.NumAlgs; k++)
            {
                _algs.Add(file.Read(k));
            }
            file.Close();
        }