Esempio n. 1
0
        /// <summary>
        ///   Initializes static members of the <see cref="Game" /> class.
        /// </summary>
        static Game()
        {
            EnableFeatures();
            ClockIncrementPerMove = new TimeSpan(0, 0, 0);
            ClockFixedTimePerMove = new TimeSpan(0, 0, 2);
            //DifficultyLevel = 12;
            ClockTime = new TimeSpan(0, 5, 0);
            ClockMaxMoves = 40;
            UseRandomOpeningMoves = true;
            EnablePondering = false;
            MoveRedoList = new Moves();
            //MaximumSearchDepth = 32;
            MoveAnalysis = new Moves();
            MoveHistory = new Moves();
            FenStartPosition = string.Empty;
            HashTable.Initialise();
            HashTablePawn.Initialise();
            HashTableCheck.Initialise();

            PlayerWhite = new PlayerWhite();
            //PlayerWhite.Intellegence = Player.PlayerIntellegenceNames.Computer;

            PlayerBlack = new PlayerBlack();
            //PlayerBlack.Intellegence = Player.PlayerIntellegenceNames.Human;

            PlayerToPlay = PlayerWhite;

            Board.EstablishHashKey();
            OpeningBookSimple.Initialise();

            PlayerWhite.Brain.ReadyToMakeMoveEvent += PlayerReadyToMakeMove;
            PlayerBlack.Brain.ReadyToMakeMoveEvent += PlayerReadyToMakeMove;

            TryRegistryKey ();

            // OpeningBook.BookConvert(Game.PlayerWhite);
        }
Esempio n. 2
0
        /// <summary>
        ///   Initializes static members of the <see cref="Game" /> class.
        /// </summary>
        static Game()
        {
            EnableFeatures();
            ClockIncrementPerMove = new TimeSpan(0, 0, 0);
            ClockFixedTimePerMove = new TimeSpan(0, 0, 0);
            DifficultyLevel = 1;
            ClockTime = new TimeSpan(0, 5, 0);
            ClockMaxMoves = 40;
            UseRandomOpeningMoves = true;
            MoveRedoList = new Moves();
            MaximumSearchDepth = 1;
            MoveAnalysis = new Moves();
            MoveHistory = new Moves();
            FenStartPosition = string.Empty;
            HashTable.Initialise();
            HashTablePawn.Initialise();
            HashTableCheck.Initialise();

            PlayerWhite = new PlayerWhite();
            PlayerBlack = new PlayerBlack();
            PlayerToPlay = PlayerWhite;
            Board.EstablishHashKey();
            OpeningBookSimple.Initialise();

            PlayerWhite.Brain.ReadyToMakeMoveEvent += PlayerReadyToMakeMove;
            PlayerBlack.Brain.ReadyToMakeMoveEvent += PlayerReadyToMakeMove;

            #if !MOBILE
            RegistryKey registryKeySoftware = Registry.CurrentUser.OpenSubKey("Software", true);
            if (registryKeySoftware != null)
            {
                RegistryKey registryKeySharpChess = registryKeySoftware.CreateSubKey(@"PeterHughes.org\SharpChess");

                if (registryKeySharpChess != null)
                {
                    if (registryKeySharpChess.GetValue("FileName") == null)
                    {
                        saveGameFileName = string.Empty;
                    }
                    else
                    {
                        saveGameFileName = registryKeySharpChess.GetValue("FileName").ToString();
                    }

                    if (registryKeySharpChess.GetValue("ShowThinking") == null)
                    {
                        ShowThinking = true;
                    }
                    else
                    {
                        ShowThinking = registryKeySharpChess.GetValue("ShowThinking").ToString() == "1";
                    }

                    // Delete deprecated values
                    if (registryKeySharpChess.GetValue("EnablePondering") != null)
                    {
                        registryKeySharpChess.DeleteValue("EnablePondering");
                    }

                    if (registryKeySharpChess.GetValue("DisplayMoveAnalysisTree") != null)
                    {
                        registryKeySharpChess.DeleteValue("DisplayMoveAnalysisTree");
                    }

                    if (registryKeySharpChess.GetValue("ClockMoves") != null)
                    {
                        registryKeySharpChess.DeleteValue("ClockMoves");
                    }

                    if (registryKeySharpChess.GetValue("ClockMinutes") != null)
                    {
                        registryKeySharpChess.DeleteValue("ClockMinutes");
                    }
                }
            }

            #endif
            // OpeningBook.BookConvert(Game.PlayerWhite);
        }