Пример #1
0
        /// <summary>
        /// Internal initialization routine to register with LC0 DLL.
        /// </summary>
        /// <param name="paths"></param>
        /// <returns></returns>
        bool Initialize(string paths)
        {
            // Validate that all the requested paths actually exist
            string[] directories = paths.Split(new char[] { ';', ',' });
            foreach (string dir in directories)
            {
                if (!Directory.Exists(dir))
                {
                    throw new Exception($"Requested tablebase directory does not exist or is inaccessible: {dir}");
                }
            }

            LCO_Interop.CheckLibraryDirectoryOnPath();

            // Determine the maximum cardinality (number of pieces) supported
            bool initialized = LCO_Interop.TBInitialize(sessionID, paths);

            if (initialized)
            {
                MaxCardinality = LCO_Interop.MaxCardinality(sessionID);
            }
            else
            {
                throw new Exception($"Loading tablebases failed, attempted {paths}");
            }
            return(initialized);
        }
Пример #2
0
        /// <summary>
        /// Internal initialization routine to register with LC0 DLL.
        /// </summary>
        /// <param name="paths"></param>
        /// <returns></returns>
        bool Initialize(string paths)
        {
            // Validate that all the requested paths actually exist
            if (!FileUtils.PathsListAllExist(paths))
            {
                throw new Exception($"One or more specified Syzygy paths not found or inaccessible: {paths} ");
            }

            LCO_Interop.CheckLibraryDirectoryOnPath();

            // Determine the maximum cardinality (number of pieces) supported
            LCO_Interop.TBInitializeStatus initStatus = LCO_Interop.TBInitialize(sessionID, paths);
            if (initStatus == LCO_Interop.TBInitializeStatus.ERROR)
            {
                throw new Exception($"Loading tablebases failed, attempted {paths}");
            }
            else
            {
                DTZAvailable   = initStatus == LCO_Interop.TBInitializeStatus.OK_WITH_DTM_DTZ;
                MaxCardinality = LCO_Interop.MaxCardinality(sessionID);
                return(true);
            }
        }